https://bz.apache.org/bugzilla/show_bug.cgi?id=58069

            Bug ID: 58069
           Summary: Biff8RC4 xorShort returns wrong value for unsigned
                    shorts
           Product: POI
           Version: 3.13-dev
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: HSSF
          Assignee: [email protected]
          Reporter: [email protected]

The change to Biff8RC4 to use a ByteBuffer broke xorShort for unsigned short
values.

I noticed this when the loading of a protected XLS file that contained a
org.apache.poi.hssf.record.pivottable.ViewFieldsRecord , which uses 0xFFFF as a
"not present" value.

3.11+ return -1 rather than 0xFFFF causing the loading of this workbook to
fail.

The following patch fixes the loading of my file (and doesn't cause anything
else to fail going by 'ant test' return code)

        public int xorShort(int rawVal) {
-           _buffer.putShort(0, (short)rawVal);
+           _buffer.putShort(0, (short) (rawVal & 0xffff));
            xor(_buffer.array(), 0, 2);
-               return _buffer.getShort(0);
+               return _buffer.getShort(0) & 0xffff;
        }

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to