Opened 6 years ago

Closed 6 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)

gdal-1.8.0-replicateword-off-by-one.patch (489 bytes) - added by bclaywell 6 years ago.

Download all attachments as: .zip

Change History (4)

Changed 6 years ago by bclaywell

comment:1 Changed 6 years ago by warmerdam

Cc: Even Rouault added
Milestone: 1.8.1

Even, perhaps this is your code?

comment:2 Changed 6 years ago by Even Rouault

Owner: changed from warmerdam to Even Rouault

comment:3 Changed 6 years ago by Even Rouault

Resolution: fixed
Status: newclosed

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)

Note: See TracTickets for help on using tickets.