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

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

Open

Description

@Metalnem

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.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions