View | Details | Raw Unified | Return to bug 49579
Collapse All | Expand All

(-)src/java/org/apache/poi/ddf/UnknownEscherRecord.java (+11 lines)
Lines 28-33 Link Here
28
 * we do not explicitly support.
28
 * we do not explicitly support.
29
 *
29
 *
30
 * @author Glen Stampoultzis (glens at apache.org)
30
 * @author Glen Stampoultzis (glens at apache.org)
31
 * @author Zhang Zhang (zhangzzh at gmail.com)
31
 */
32
 */
32
public final class UnknownEscherRecord extends EscherRecord {
33
public final class UnknownEscherRecord extends EscherRecord {
33
    private static final byte[] NO_BYTES = new byte[0];
34
    private static final byte[] NO_BYTES = new byte[0];
Lines 58-63 Link Here
58
            }
59
            }
59
            return bytesWritten;
60
            return bytesWritten;
60
        }
61
        }
62
		/*
63
		 * Modified by Zhang Zhang
64
		 * Have a check between avaliable bytes and bytesRemaining, 
65
		 * take the avaliable length if the bytesRemaining out of range.
66
		 * July 09, 2010
67
		 */
68
		int avaliable = data.length - (offset + 8);
69
		if (bytesRemaining > avaliable) {
70
			bytesRemaining = avaliable;
71
		}
61
        thedata = new byte[bytesRemaining];
72
        thedata = new byte[bytesRemaining];
62
        System.arraycopy( data, offset + 8, thedata, 0, bytesRemaining );
73
        System.arraycopy( data, offset + 8, thedata, 0, bytesRemaining );
63
        return bytesRemaining + 8;
74
        return bytesRemaining + 8;

Return to bug 49579