[VRT] [PATCH] VRTDerivedRasterBand with ComplexSource and nodata value yields potentially uninitialized buffer
|Reported by:||bclaywell||Owned by:||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 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 here.
However, VRTDerivedRasterBand::IRasterIO does *not* initialize its buffers before calling out to the individual sources to populate those buffers; see 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.
Change History (7)
comment:2 Changed 6 years ago by
|Summary:||[VRT] VRTDerivedRasterBand with ComplexSource and nodata value yields potentially uninitialized buffer → [VRT] [PATCH] VRTDerivedRasterBand with ComplexSource and nodata value yields potentially uninitialized buffer|