creating Nitf from Nitf with BLOCKA + other tags results in corrupt output
|Reported by:||jeepingben||Owned by:||warmerdam|
|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.