Pete,

ouch, confirmed, and fix queued in https://github.com/OSGeo/gdal/pull/5547 . And the commit you mention was indeed the culprit.

Potential workarounds (besides generating the VRT on GDAL <= 3.4.0)

- if using gdalbuildvrt on a single source, you could just use "gdal_translate sen2_20210527_aber_subset.kea test.vrt -b 2", that will do the job equally well

- if using multiple sources, you could also use gdal_translate with band selection on the VRT generated by gdalbuildvrt (without band selection) to extract only the band(s) you're interested in, but obviously that creates one more file

(do not hesitate to file an issue in github for obvious regressions like that. emails tend to be easily forgotten)

Even

Le 30/03/2022 à 12:59, Pete Bunting via gdal-dev a écrit :
Hi,

With the release of gdal 3.4.2, gdalbuildvrt seems to have a bug when selecting 
image bands. It works OK when band 1 is specified but if other band(s) in the image 
are used without band 1 then it seg faults. I noticed there were some changes around 
checking bands in the release notes "change logic to check homogenous number of 
bands” and I had a quick look at the commits but cannot see where this is occurring.

# Works:
gdalbuildvrt test.vrt sen2_20210527_aber_subset.kea -b 1

# Seg Faults:
gdalbuildvrt test.vrt sen2_20210527_aber_subset.kea -b 2

ERROR 5: sen2_20210527_aber_subset.kea: GDALDataset::GetRasterBand(2) - Illegal 
band #
Segmentation fault (core dumped)


# Works:
gdalbuildvrt test.vrt sen2_20210527_aber_subset.kea -b 1 -b 2 -b 3

# Seg Faults:
gdalbuildvrt test.vrt sen2_20210527_aber_subset.kea -b 2 -b 3 -b 4

ERROR 5: sen2_20210527_aber_subset.kea: GDALDataset::GetRasterBand(4) - Illegal 
band #
Segmentation fault (core dumped)

Note, the input image I was using has 10 bands and these commands work with 3.4.1. I get 
the same seg fault on Mac, Linux and Windows ("Windows fatal exception: access 
violation").

Many thanks,

Pete
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

--
http://www.spatialys.com
My software is free, but my time generally not.

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to