On Fri, 7 Oct 2011, Joe Gallo wrote:
A coworker and I ran into some ArrayIndexOutOfBoundsExceptions while processing ppt files using POI (by way of Tika), and tracked the problem down to some of the code in VariantSupport.

Any chance you could open a new bug in bugzilla, and post both the patch and a problem file there? We can then use the problem file as part of a unit test to verify the fix works, as well as to ensure it doesn't get broken going forward

Cheers
Nick

Joe

Index: src/java/org/apache/poi/hpsf/VariantSupport.java
===================================================================
--- src/java/org/apache/poi/hpsf/VariantSupport.java    (revision 1179871)
+++ src/java/org/apache/poi/hpsf/VariantSupport.java    (working copy)
@@ -252,10 +252,10 @@
                 */
                final int first = o1 + LittleEndian.INT_SIZE;
                long last = first + LittleEndian.getUInt(src, o1) - 1;
-                long l = last - first;
+                long l = last - first + 1; // bytes
                o1 += LittleEndian.INT_SIZE;
                StringBuffer b = new StringBuffer((int) (last - first));
-                for (int i = 0; i <= l; i++)
+                for (int i = 0; i < l/2; i++) // characters
                {
                    final int i1 = o1 + (i * 2);
                    final int i2 = i1 + 1;



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



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

Reply via email to