Opened 12 years ago
Closed 12 years ago
#4090 closed defect (fixed)
[PATCH] Off-by-one error in GDALReplicateWord
Reported by: | bclaywell | Owned by: | Even Rouault |
---|---|---|---|
Priority: | normal | Milestone: | 1.8.1 |
Component: | GDAL_Raster | Version: | 1.8.0 |
Severity: | normal | Keywords: | |
Cc: | Even Rouault |
Description
(This bug was observed in 1.8.0, but the relevant code in trunk appears unchanged.)
When attempting to expand the canvas of an image with a non-zero nodata value (1, in this case) we noticed that the rightmost column of the image was still zero. Inspection of the GByte packed buffer case in GDALReplicateWord reveals that the count argument to memset is nWordCount - 1 (line 1095) even though it was already decremented on line 1086 to account for the value already being copied into the first element of pDstData.
Attachments (1)
Change History (4)
by , 12 years ago
Attachment: | gdal-1.8.0-replicateword-off-by-one.patch added |
---|
comment:1 by , 12 years ago
Cc: | added |
---|---|
Milestone: | → 1.8.1 |
comment:2 by , 12 years ago
Owner: | changed from | to
---|
comment:3 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
r22420 /trunk/gdal/gcore/rasterio.cpp: GDALReplicateWord(): fix off-by-one error initialization in eDstType == GDT_Byte and nDstPixelOffset == 1 case (#4090, by bclaywell)
r22421 /branches/1.8/gdal/gcore/rasterio.cpp: GDALReplicateWord(): fix off-by-one error initialization in eDstType == GDT_Byte and nDstPixelOffset == 1 case (#4090, by bclaywell)
Even, perhaps this is your code?