ASF Bugzilla – Attachment 32850 Details for
Bug 58069
Biff8RC4 xorShort returns wrong value for unsigned shorts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for Biff8DecryptingStream
biff8dec.patch (text/plain), 2.82 KB, created by
Andreas Beeker
on 2015-06-22 22:54:59 UTC
(
hide
)
Description:
Patch for Biff8DecryptingStream
Filename:
MIME Type:
Creator:
Andreas Beeker
Created:
2015-06-22 22:54:59 UTC
Size:
2.82 KB
patch
obsolete
>Index: src/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java >=================================================================== >--- src/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java (revision 1686927) >+++ src/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java (working copy) >@@ -95,7 +95,7 @@ > > > public int readUByte() { >- return _cipher.xorByte(_le.readUByte()); >+ return readByte() & 0xFF; > } > public byte readByte() { > return (byte) _cipher.xorByte(_le.readUByte()); >@@ -103,7 +103,7 @@ > > > public int readUShort() { >- return _cipher.xorShort(_le.readUShort()); >+ return readShort() & 0xFFFF; > } > public short readShort() { > return (short) _cipher.xorShort(_le.readUShort()); >Index: src/testcases/org/apache/poi/hssf/record/crypto/TestBiff8DecryptingStream.java >=================================================================== >--- src/testcases/org/apache/poi/hssf/record/crypto/TestBiff8DecryptingStream.java (revision 1686927) >+++ src/testcases/org/apache/poi/hssf/record/crypto/TestBiff8DecryptingStream.java (working copy) >@@ -96,9 +96,21 @@ > } > > public void confirmShort(int expVal) { >- cmp(HexDump.shortToHex(expVal), HexDump.shortToHex(_bds.readUShort())); >+ cmp(HexDump.shortToHex(expVal), HexDump.shortToHex(_bds.readShort())); > } > >+ public void confirmUShort(int expVal) { >+ cmp(HexDump.shortToHex(expVal), HexDump.shortToHex(_bds.readUShort())); >+ } >+ >+ public short readShort() { >+ return _bds.readShort(); >+ } >+ >+ public int readUShort() { >+ return _bds.readUShort(); >+ } >+ > public void confirmInt(int expVal) { > cmp(HexDump.intToHex(expVal), HexDump.intToHex(_bds.readInt())); > } >@@ -106,7 +118,7 @@ > public void confirmLong(long expVal) { > cmp(HexDump.longToHex(expVal), HexDump.longToHex(_bds.readLong())); > } >- >+ > private void cmp(char[] exp, char[] act) { > if (Arrays.equals(exp, act)) { > return; >@@ -166,6 +178,15 @@ > st.rollForward(0x0C04, 0x0FF8); > st.confirmLong(0x6AA2D5F6B975D10CL); > st.confirmLong(0x34248ADF7ED4F029L); >+ // check for signed/unsigned shorts #58069 >+ st.rollForward(0x1008, 0x7213); >+ st.confirmUShort(0xFFFF); >+ st.rollForward(0x7215, 0x1B9AD); >+ st.confirmShort(-1); >+ st.rollForward(0x1B9AF, 0x37D99); >+ assertEquals(0xFFFF, st.readUShort()); >+ st.rollForward(0x37D9B, 0x4A6F2); >+ assertEquals(-1, st.readShort()); > st.assertNoErrors(); > } > >@@ -229,7 +250,7 @@ > st.confirmData("01 C2 4E 55"); // first 4 bytes in next block > st.assertNoErrors(); > } >- >+ > private static StreamTester createStreamTester(int mockStreamStartVal, String keyDigestHex, int expectedFirstInt) { > return new StreamTester(new MockStream(mockStreamStartVal), keyDigestHex, expectedFirstInt); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 58069
: 32850