Opened 7 years ago

Closed 7 years ago

#5585 closed defect (fixed)

JP2KAK format: Generating TLM causes an error due to bad fseek call

Reported by: plroit Owned by: warmerdam
Priority: normal Milestone: 1.11.1
Component: GDAL_Raster Version: 1.11.0
Severity: blocker Keywords: jp2kak TLM fseek
Cc:

Description

Hi,

There is a bug in GDAL_ROOT\frmts\jp2kak\vsil_target.h in method vsil_target::end_rewrite You can see that the parameters to the VSIFSeekL method call are swapped in place. (Compare to the same method call in vsil_target::start_rewrite). What it should be: VSIFSeekL( file, 0, SEEK_END) != 0 What it is as of today: VSIFSeekL( file, SEEK_END, 0) != 0

The error can be recreated by using multiple tiles with ORGgen_tlm=X option, where X is the estimated (upper bound) number of tile-parts per tile.

This effectively prevents the caller from generating jp2 files with TLM index. The TLM index is generated by Kakadu library after all of the tile-parts are flushed to the target file. Kakadu library then seeks back to a pre-configured location to write the TLM segment by calling start_rewrite. To return the file position to the previous location, kakadu calls end_rewrite and proceeds in operation.

Change History (1)

comment:1 Changed 7 years ago by Even Rouault

Milestone: 1.11.1
Resolution: fixed
Status: newclosed

trunk r27541, branches/1.11 r27543 "JP2KAK: fix bug in vsil_target::end_rewrite() that prevented TLM index to be generated (#5585, patch by plroit)"

Note: See TracTickets for help on using tickets.