You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by lb...@apache.org on 2014/01/22 01:12:32 UTC
svn commit: r1560225 -
/xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFPainter.java
Author: lbernardo
Date: Wed Jan 22 00:12:32 2014
New Revision: 1560225
URL: http://svn.apache.org/r1560225
Log:
BATIK-963: ArrayIndexOutOfBounds in AbstractWMFPainter with 1-bit color images; patch submitted by a6537691, AKA Viliam Durina
Modified:
xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFPainter.java
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFPainter.java?rev=1560225&r1=1560224&r2=1560225&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFPainter.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFPainter.java Wed Jan 22 00:12:32 2014
@@ -156,7 +156,7 @@ public class AbstractWMFPainter {
* to overall size, else we will go after the end of the byte array...
*/
_size = bit.length - offset;
- int pad = (_size / _height) - _width;
+ int pad = (_size / _height) - _width;
for (int j = 0; j < _height; j++) {
for (int i = 0; i < _width; i++) {
bitI[_width*(_height-j-1)+i] = palette [((int)bit[offset] & 0x00ff)];
@@ -178,7 +178,7 @@ public class AbstractWMFPainter {
offset += 4;
}
- // populate the int array : each pixel correspond to a bit in the byte array
+ // populate the int array : each pixel corresponds to a bit in the byte array
int pos = 7;
byte currentByte = bit[offset];
// padded to long words
@@ -191,7 +191,8 @@ public class AbstractWMFPainter {
if (pos == -1) {
pos = 7;
offset++;
- currentByte = bit[offset];
+ if (offset < bit.length)
+ currentByte = bit[offset];
}
}
offset +=pad;