Ticket #3926 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

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

nitf_scanline_read_write.patch Download (0.8 KB) - added by klaricmn 2 years ago.

Change History

Changed 2 years ago by klaricmn

Changed 2 years ago by rouault

  • component changed from default to GDAL_Raster
  • milestone 1.8.0 deleted

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)

Changed 2 years ago by rouault

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to 1.9.0
Note: See TracTickets for help on using tickets.