Browse Source

Make reading long value columns more lenient (MEMO/OLE)

git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@814 f203690c-595d-4dc9-a70b-905162fa7fd2
tags/jackcess-2.0.1
James Ahlborn 10 years ago
parent
commit
1adb6ea69d

+ 6
- 0
src/changes/changes.xml View File

@@ -11,6 +11,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="2.0.0" date="2013-08-26">
<action dev="jahlborn" type="update">
@@ -23,6 +26,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">

+ 15
- 2
src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java View File

@@ -671,6 +671,15 @@ public class ColumnImpl implements Column, Comparable<ColumnImpl> {
// 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 {
@@ -694,8 +703,12 @@ public class ColumnImpl implements Column, Comparable<ColumnImpl> {
short rowStart = TableImpl.findRowStart(lvalPage, rowNum, getFormat());
short rowEnd = TableImpl.findRowEnd(lvalPage, rowNum, getFormat());

if((rowEnd - rowStart) != length) {
throw new IOException("Unexpected lval row length");
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];
}
lvalPage.position(rowStart);

Loading…
Cancel
Save