Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 6.0
-
Fix Version/s: 6.0
-
Component/s: Core/Parsing
-
Labels:None
-
Environment:ICEpdf 5.0.0 open source release
Description
When a PDF file is decoded using linear traversal, the offsets in the file are calculated during parsing rather than using offsets from the xref tables. There seem to be errors in the offset calculation causing parsing errors later on.
The snippet below mimics a scenario where a file was decoded, soft references were cleared and the LazyObjectLoader subsequently attempts to reload an object. This results in an EmptyStackException due to the file offset being incorrect.
{code}Document d = new Document();
d.setFile( "USGS NJ_Jersey_City_20110609_TM_geo.pdf" );
Page page = d.getPageTree().getPage( 0 );
page.init();
Library library = page.getLibrary();
Reference reference = new Reference( 496, 0 );
library.getObject( reference );
Field lolField = library.getClass().getDeclaredField( "lazyObjectLoader" );
lolField.setAccessible( true );
LazyObjectLoader lol = ( LazyObjectLoader ) lolField.get( library );
lol.loadObject( reference );{code}
The snippet below mimics a scenario where a file was decoded, soft references were cleared and the LazyObjectLoader subsequently attempts to reload an object. This results in an EmptyStackException due to the file offset being incorrect.
{code}Document d = new Document();
d.setFile( "USGS NJ_Jersey_City_20110609_TM_geo.pdf" );
Page page = d.getPageTree().getPage( 0 );
page.init();
Library library = page.getLibrary();
Reference reference = new Reference( 496, 0 );
library.getObject( reference );
Field lolField = library.getClass().getDeclaredField( "lazyObjectLoader" );
lolField.setAccessible( true );
LazyObjectLoader lol = ( LazyObjectLoader ) lolField.get( library );
lol.loadObject( reference );{code}
The test file USGS NJ_Jersey_City_20110609_TM_geo.pdf is too large to attach to this issue. It can be obtained from the USGS at http://ims.er.usgs.gov/gda_services/download?item_id=5268881&quad=Jersey%20City&state=NJ&grid=7.5X7.5&series=TNM%20GeoPDF