Opened 7 years ago

Closed 7 years ago

#3926 closed defect (fixed)

Probable logic errors in NITF driver

Reported by: klaricmn Owned by: warmerdam
Priority: normal Milestone: 1.9.0
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: nitf
Cc:

Description

In two locations within nitfimage.c a check is performed to determine if an image is tiled or not prior to performing scanline operations. I believe these checks to be incorrect because they fail (saying that the image is tiled) if either psImage->nBlocksPerRow or psImage->nBlocksPerColumn is not equal to 1. Thus, the only way that an image cannot be considered tiled by this definition is to have the entire image be one big tile. That's not really scanline access in that case.

The attached patch, modifies those two checks such that an image is considered tiled if both psImage->nBlocksPerRow and psImage->nBlocksPerColumn are not equal to 1.

Attachments (1)

nitf_scanline_read_write.patch (852 bytes) - added by klaricmn 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by klaricmn

comment:1 Changed 7 years ago by Even Rouault

Component: defaultGDAL_Raster
Milestone: 1.8.0

I think the checks of NITFReadImageLine() and NITFWriteImageLine() are correct. Scanline access is only meant to be used on images made of one big tile. This is the definition of an untiled image. As soon as nBlockPerRow or nBlockPerColumn are > 1, the image is tiled.

However, when looking at this, I discovered that nitfdataset.cpp could use the scanline API in non legitimate case, for example when nBlockWidth < nRasterXSize and nBlockHeight == 1

r21543 /trunk/ (3 files in 2 dirs): NITF: make sure scanline access is used only on single block image, not just when nBlockYSize = 1 (#3926)

comment:2 Changed 7 years ago by Even Rouault

Milestone: 1.9.0
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.