Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2233

Java compiler should defensively copy its binary inputs

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9
    • 0.9.2
    • Java - Compiler
    • None
    • Patch Available

    Description

      Currently if someone calls the bufferForField accessor then calls ByteBuffer.get, this mutates the struct's ByteBuffer field. Subsequent calls to bufferForField return the mutated field and thus calls to ByteBuffer.get return unexpected results.

          MyStruct myStruct = ...;
          byte[] array = new byte[myStruct.bufferForValue().capacity()];
          someStruct.bufferForValue().get(array);
          someStruct.bufferForValue().get(array);  // previously, NPE
      

      Attachments

        1. THRIFT-2233.patch
          6 kB
          Andrew Gaul

        Activity

          People

            gaul Andrew Gaul
            gaul Andrew Gaul
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: