NitfDataset cannot update COMRAT for images with comments
|Reported by:||jeepingben||Owned by:||warmerdam|
I found this while writing Nitf images with JPEG2000 compression. If the image contains comments, the code around nitfdataset.cpp:4569 will not find IC, so it will not know where to put the updated COMRAT information. An error is displayed:
Warning 1: Unable to locate COMRAT to update in NITF header.
In addition to checking offset 778 and 838, it needs to check each multiple of 80 bytes away from each of those offsets. This would be dangerous in the case where a comment began with the IC value for the image.
It would probably be safer to examine ICORD (offset 776), then if there is an IGEOLO, skip it and read NICOM, then skip 80 * NICOM bytes to check for IC.