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)

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.12.0, 3.0.0
    • Affects Version/s: 2.11.0
    • Component/s: BSON
    • Labels:

      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 "<".

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

              Created:
              Updated:
              Resolved: