Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-816

Invalid buffer size safety check in org.bson.io.Bits.readFully(stream, buf, off, len)

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.12.0, 3.0.0
    • 2.11.0
    • BSON

    Description

      Test:
      call org.bson.io.Bits.readFully(new ByteArrayInputStream("some sample text".getBytes()), new byte[20], 0, 10);

      Expected:
      10 bytes are read.

      Observed:
      java.lang.IllegalArgumentException: Buffer is too small

      The safety check
      if (b.length - startOffset > length)

      { throw new IllegalArgumentException("Buffer is too small"); }

      should test for "<".

      Attachments

        Activity

          People

            Unassigned Unassigned
            chaus_de Carsten Haustein
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: