Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#1427 closed defect (worksforme)

NITF driver reading from incorrect file offsets

Reported by: grevedan@… Owned by: warmerdam
Priority: normal Milestone: 1.4.2
Component: GDAL_Raster Version: 1.4.0
Severity: major Keywords:
Cc:

Description (last modified by warmerdam)

I'm reporting a bug in the NITF driver. The 2007-01-07 snapshot of nitfmage.c, line 596 needs to be removed.

As can be seen in this snippet, the nOffset += 20 causes the NITFImageAccess function to be 20 bytes off from this point. the nIDLVL field should be 2 bytes after NBPP.

      psImage->nBitsPerSample =
            atoi(NITFGetField(szTemp, pachHeader, nOffset+18, 2));
       
        nOffset += 20;

        if( psImage->nABPP == 0 )
            psImage->nABPP = psImage->nBitsPerSample;

        psImage->nIDLVL = atoi(NITFGetField(szTemp,pachHeader, nOffset+20, 3));

Attachments (1)

nitf.zip (49.7 KB ) - added by grevedan@… 17 years ago.
Updates to NITF driver

Download all attachments as: .zip

Change History (6)

by grevedan@…, 17 years ago

Attachment: nitf.zip added

Updates to NITF driver

comment:1 by warmerdam, 17 years ago

Dan,

I think the nOffset += 20 line is ok, but that the IDLVL and related
fields need to have that offset taken into account.  I have committed
a fix for this, and now IDLVL seems to be working again. 

Note this fix is not in 1.4.0, but will appear in 1.4.1 when released.

I would like to hold the 2.0/2.1 creation option code till after the GDAL
1.4.x branch has been split off as I'm not comfortable including that in the
stable branch. 

comment:2 by grevedan@…, 17 years ago

Yup, i saw today removing the line wouldn't fix the problem, it either had to be moved after LDLVL or offsets re-done.

I'll resync to the latest GDAL NITF snapshot, re-apply my changes and continue my testing.  My NITF update has a lot of changes so I understand the need to withhold merging the code in.  I'll give the code a couple once-overs this week and if i find any glaring errors, I'll submit them to this thread.

comment:4 by warmerdam, 17 years ago

Description: modified (diff)
Milestone: 1.4.2
Priority: highestnormal
Severity: normalmajor

Dan,

Did you ever get a chance to retest this?

I'd like to close this report if the issue is gone.

comment:5 by warmerdam, 17 years ago

Resolution: worksforme
Status: assignedclosed

Closing for now, feel free to reopen this Dan if you believe the problem still exists.

comment:6 by grevedan, 17 years ago

Frank,

Missed your early message, will double check the fix this week...

-- dan

Note: See TracTickets for help on using tickets.