diff options
author | Dominik Stadler <centic@apache.org> | 2015-05-11 19:59:52 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2015-05-11 19:59:52 +0000 |
commit | 4df135705847177e67a73bf5b62045e813a1a041 (patch) | |
tree | 581f7caf245fa537386578c022f4144bc85e11cb /src | |
parent | 14ca466474ace02350c13ff08088e35b48d31fc8 (diff) | |
download | poi-4df135705847177e67a73bf5b62045e813a1a041.tar.gz poi-4df135705847177e67a73bf5b62045e813a1a041.zip |
Add checks for invalid row number in RowRecord to find corrupted files earlier
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1678810 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/poi/hssf/record/RowRecord.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/java/org/apache/poi/hssf/record/RowRecord.java b/src/java/org/apache/poi/hssf/record/RowRecord.java index 75d3f99b13..7a9026dc54 100644 --- a/src/java/org/apache/poi/hssf/record/RowRecord.java +++ b/src/java/org/apache/poi/hssf/record/RowRecord.java @@ -64,6 +64,9 @@ public final class RowRecord extends StandardRecord { // bit 15 is unused public RowRecord(int rowNumber) { + if(rowNumber < 0) { + throw new IllegalArgumentException("Invalid row number " + rowNumber + " specified"); + } field_1_row_number = rowNumber; field_4_height = (short)0xFF; field_5_optimize = ( short ) 0; @@ -76,6 +79,9 @@ public final class RowRecord extends StandardRecord { public RowRecord(RecordInputStream in) { field_1_row_number = in.readUShort(); + if(field_1_row_number < 0) { + throw new IllegalArgumentException("Invalid row number " + field_1_row_number + " found in InputStream"); + } field_2_first_col = in.readShort(); field_3_last_col = in.readShort(); field_4_height = in.readShort(); |