Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-880

System.IndexOutOfRange Exception in Check

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: 1.8.3
    • Fix Version/s: 1.9
    • Component/s: None
    • Labels:
    • Environment:
      .NET Framework 4.5.1, ASP.NET MVC 5, Windows 8.1
    • Backwards Compatibility:
      Minor Change

      Description

      When passing an empty dictionary key of type string, the serializer breaks inside the CheckElementName method (BsonWriter.cs)

      The bug is thrown because the code tries to access the zero index of string-char array. As the string is empty, there is no indexes for the char array.

      I suggest a verification of the element name to test if it is empty, and if it is, throw the BsonSerializationException with a proper message.

      I can contribute to this bug resolution in GitHub if I will be authorized.

      Thank you all.

      (See attachments for a better analysis)

        Attachments

        1. bug.png
          57 kB
          Gustavo Gondim
        2. test case.png
          10 kB
          Gustavo Gondim

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              ggondim Gustavo Gondim
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: