id summary reporter owner description type status priority milestone component version severity resolution keywords cc 4045 [VRT] [PATCH] VRTDerivedRasterBand with ComplexSource and nodata value yields potentially uninitialized buffer bclaywell warmerdam "(This bug was observed in 1.8.0 but it looks like the affected code is still the same in trunk, so the traclinks below go to trunk.) VRTComplexSource::RasterIO appears to expect that the buffer pointed to by its pData argument has already been initialized with zero or a nodata value by its caller, as the per-pixel loop simply skips to the next pixel if a nodata value is encountered, as seen [http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/vrt/vrtsources.cpp#L1351 here]. When VRTComplexSource::RasterIO is called by VRTSourcedRasterBand::IRasterIO, this is not a problem, as the buffer is correctly initialized with zeroes or nodata, starting [http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/vrt/vrtsourcedrasterband.cpp#L155 here]. However, VRTDerivedRasterBand::IRasterIO does *not* initialize its buffers before calling out to the individual sources to populate those buffers; see [http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/vrt/vrtderivedrasterband.cpp#L359 here]. The buffers are simply malloc'd and then immediately passed to VRTSource::RasterIO to be populated, with no initialization. In other words, any pixel in the source image that equals the !ComplexSource's nodata value will never be initialized and will instead contain whatever garbage happened to be at those locations in memory." defect closed normal 1.8.1 GDAL_Raster 1.8.0 normal fixed klaricmn antonio