Opened 13 years ago
Closed 13 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)
Change History (3)
by , 13 years ago
Attachment: | nitf_scanline_read_write.patch added |
---|
comment:1 by , 13 years ago
Component: | default → GDAL_Raster |
---|---|
Milestone: | 1.8.0 |
comment:2 by , 13 years ago
Milestone: | → 1.9.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
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)