diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2013-10-04 02:39:47 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2013-10-04 02:39:47 +0000 |
commit | 85d7c078cba5b0dcd37c28ed62920af1fc9f6566 (patch) | |
tree | f0a876ee65dfa92028cbe9ed43c7adab39173f08 | |
parent | 339acb270598ba3153e912e0561ff308bd048c0b (diff) | |
download | jackcess-85d7c078cba5b0dcd37c28ed62920af1fc9f6566.tar.gz jackcess-85d7c078cba5b0dcd37c28ed62920af1fc9f6566.zip |
Make reading long value columns more lenient (MEMO/OLE)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/jackcess-1.2.14@813 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r-- | src/changes/changes.xml | 3 | ||||
-rw-r--r-- | src/java/com/healthmarketscience/jackcess/Column.java | 18 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/changes/changes.xml b/src/changes/changes.xml index a019ca8..e47124f 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -8,6 +8,9 @@ <action dev="jahlborn" type="fix" system="SourceForge2" issue="97"> Ignore invalid column usage map definitions. </action> + <action dev="jahlborn" type="fix"> + Make reading long value columns more lenient (MEMO/OLE). + </action> </release> <release version="1.2.14.2" date="2013-08-25"> <action dev="jahlborn" type="fix" system="SourceForge2" issue="96"> diff --git a/src/java/com/healthmarketscience/jackcess/Column.java b/src/java/com/healthmarketscience/jackcess/Column.java index 69412a8..4652e5f 100644 --- a/src/java/com/healthmarketscience/jackcess/Column.java +++ b/src/java/com/healthmarketscience/jackcess/Column.java @@ -931,6 +931,15 @@ public class Column implements Comparable<Column> { // inline long value def.getInt(); //Skip over lval_dp def.getInt(); //Skip over unknown + + int rowLen = def.remaining(); + if(rowLen < length) { + // warn the caller, but return whatever we can + LOG.warn(getName() + " value may be truncated: expected length " + + length + " found " + rowLen); + rtn = new byte[rowLen]; + } + def.get(rtn); } else { @@ -954,6 +963,15 @@ public class Column implements Comparable<Column> { short rowStart = Table.findRowStart(lvalPage, rowNum, getFormat()); short rowEnd = Table.findRowEnd(lvalPage, rowNum, getFormat()); + int rowLen = rowEnd - rowStart; + if(rowLen < length) { + // warn the caller, but return whatever we can + LOG.warn(getName() + " value may be truncated: expected length " + + length + " found " + rowLen); + rtn = new byte[rowLen]; + } + + if((rowEnd - rowStart) != length) { throw new IOException("Unexpected lval row length"); } |