What is the bug?
In GDAL 3.13.0, the COG driver gained Create capability (in addition to CreateCopy available in older versions). When writing data blocks with GDALRasterBand::RasterIO this crashes when using panBandMap = NULL while it works with panBandMap = {1}
It seems that python GDAL does not have this problem because the NULL is replaced by the band numbers.
Steps to reproduce the issue
#include <cstdio>
#include <vector>
#include <gdal.h>
#include <gdal_priv.h>
int main() {
GDALAllRegister();
GDALDriver* drv = GetGDALDriverManager()->GetDriverByName("COG");
GDALDataset* ds = drv->Create("./cog_crash.tif", 95, 90, 1, GDT_Int16, nullptr);
std::vector<int16_t> buf(95 * 90, 0);
std::printf("RasterIO\n");
ds->RasterIO(GF_Write, 0, 0, 95, 90, buf.data(), 95, 90, GDT_Int16, 1,
nullptr, // panBandMap == NULL : the problem
0, 0, 0, nullptr);
std::printf("never reached\n");
GDALClose(ds);
return 0;
}
Versions and provenance
GDAL 3.13.0 with R/terra in rocker/r-base docker Debian container
Additional context
The problem was reported here and then here
What is the bug?
In GDAL 3.13.0, the COG driver gained
Createcapability (in addition toCreateCopyavailable in older versions). When writing data blocks with GDALRasterBand::RasterIO this crashes when usingpanBandMap = NULLwhile it works withpanBandMap = {1}It seems that python GDAL does not have this problem because the NULL is replaced by the band numbers.
Steps to reproduce the issue
Versions and provenance
GDAL 3.13.0 with R/terra in rocker/r-base docker Debian container
Additional context
The problem was reported here and then here