Opened 11 years ago

Closed 11 years ago

#4958 closed defect (fixed)

creating Nitf from Nitf with BLOCKA + other tags results in corrupt output

Reported by: jeepingben Owned by: warmerdam
Priority: normal Milestone: 1.9.3
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: nitf blocka tre


Nitf images with a BLOCKA tag result in corrupt files if there are other tags specified in the TRE= creation options.

I found this while doing a createCopy to convert Nitf to Nitf wrapped JPEG2000.

The problem is in Nitffile.c and unclear definition of the nOffsetTREInHeader parameter to NITFWriteTRE(). The callers are passing the offset to the end of the last TRE, but NITFWriteTRE() is treating it like the offset to the first TRE. It is not clear which is correct, but it seems like the offset to the first TRE could be computed easily from nOffsetUDIDL and wouldn't need to be passed in.

The fix for this is easy once we know what nOffsetTREinHeader is supposed to contain.

Attachments (1)

UNKNOWN_IMG01001AA00000_0100001AA0100001.r0.r5 (3.2 KB ) - added by jeepingben 11 years ago.
image that shows the problem

Download all attachments as: .zip

Change History (2)

by jeepingben, 11 years ago

image that shows the problem

comment:1 by Even Rouault, 11 years ago

Component: defaultGDAL_Raster
Keywords: nitf blocka tre added
Milestone: 1.9.3
Resolution: fixed
Status: newclosed

Good analysis. Fixed in trunk (r25541) and in branches/1.9 (r25542)

Note: See TracTickets for help on using tickets.