Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

JsonSerializer.Deserialize<dynamic> can throw many unexpected exceptions #142

Open
Metalnem opened this issue Dec 24, 2018 · 0 comments
Open

Comments

@Metalnem
Copy link

In most cases, JsonSerializer throws JsonParsingException when encountering a malformed input. However, JsonSerializer.Deserialize can also throw many unexpected exceptions when deserializing files from the attached archive. These are:

  • ArgumentNullException
  • ArgumentException
  • FormatException
  • IndexOutOfRangeException
  • InvalidOperationException

You can run the following code to reproduce it (the path variable should contain the path to one of the extracted files):

using (var file = File.OpenRead(path))
{
  JsonSerializer.Deserialize<dynamic>(file);
}

Found via SharpFuzz.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant