When reading children objects of a folder in an ANSI PST file, we often get an
"Unable to seek past end of item! ..." exception. By looking at the code, it
looks like the RowIndex inside a Table Context (TC) is incorrectly decoded.
The code is located in the PSTTable7C constructor:
numberOfKeys = keyTableInfo.length() / (sizeOfItemKey+sizeOfItemValue);
offset = 0;
for (int x = 0; x < numberOfKeys; x++) {
int Context = (int)keyTableInfo.seekAndReadLong(offset, 4);
int RowIndex = (int)keyTableInfo.seekAndReadLong(offset+4, 4);
keyMap.put(Context, RowIndex);
offset += 8;
}
the problem is that in an ANSI file, the RowIndex size is 2 bytes long and not
4.
I suggest to use a code like:
numberOfKeys = keyTableInfo.length() / (sizeOfItemKey+sizeOfItemValue);
offset = 0;
for (int x = 0; x < numberOfKeys; x++) {
int Context = (int)keyTableInfo.seekAndReadLong(offset, sizeOfItemKey);
offset += sizeOfItemKey;
int RowIndex = (int)keyTableInfo.seekAndReadLong(offset, sizeOfItemValue);
offset += sizeOfItemValue;
keyMap.put(Context, RowIndex);
}
Original issue reported on code.google.com by luc.cl...@gmail.com on 15 Jul 2011 at 10:55
Original issue reported on code.google.com by
luc.cl...@gmail.com
on 15 Jul 2011 at 10:55Attachments: