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.  

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]

Reply via email to