Skip to content

Double.Parse throws AccessViolationException on .NET Core 3.0 #28872

Description

@Metalnem

Double.Parse sometimes throws AccessViolationException on .NET Core 3.0. Here's the snippet you can use to reproduce this:

Double.Parse("0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000");

The stack trace:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at System.Number+BigInteger.CountSignificantBits(BigInteger ByRef)
   at System.Number.NumberToFloatingPointBitsSlow(NumberBuffer ByRef, FloatingPointInfo ByRef, UInt32, UInt32, UInt32)
   at System.Number.NumberToFloatingPointBits(NumberBuffer ByRef, FloatingPointInfo ByRef)
   at System.Number.NumberToDouble(NumberBuffer ByRef)
   at System.Number.TryParseDouble(System.ReadOnlySpan`1<Char>, System.Globalization.NumberStyles, System.Globalization.NumberFormatInfo, Double ByRef)
   at System.Double.Parse(System.String)

I'm using the latest .NET Core 3.0 daily build:

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview4-010607
 Commit:    ccd2f7cfaa

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx.10.14-x64
 Base Path:   /Users/Metalnem/Temp/dotnet-sdk-latest-osx-x64/sdk/3.0.100-preview4-010607/

Found via SharpFuzz.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions