[gdal-dev] Segmentation fault on BuildOverviews

Jon Morris Jon.Morris at jbarisk.com
Mon Jun 8 01:25:20 PDT 2020

Hello all,

I think I've found an edge case in gdal.Dataset.BuildOverviews. I'm using GDAL 3.0.4 and have found that some of our BuildOverviews tests were crashing out with a seg fault. On investigation, it seems to be when COMPRESS_OVERVIEW is set to LZW, the height is greater than the width, and the overview list is long enough that we will end up with some 1x1 overviews. Here is a code snippet that reproduces the crash.

from osgeo import gdal

gdal.SetConfigOption('COMPRESS_OVERVIEW', 'LZW')

temp_path = '/tmp/test.tif'
drv = gdal.GetDriverByName('GTiff')
raster_ds = drv.Create(temp_path, 5, 6, 1, gdal.GDT_Int16)
del raster_ds

tif = gdal.OpenEx(temp_path, gdal.GA_ReadOnly)
tif.BuildOverviews('nearest', overviewlist=[2, 4, 8])

The data type doesn't seem to matter (I've also tried Float32), but it seems that the raster dimensions are important. I couldn't get it to fail if the width was equal to or greater than the height.



Jon Morris
Software Developer

Skype<sip:jon.morris at jbarisk.com>

COVID-19. During the current outbreak JBA remains open for business and we continue to deliver our services. However, we have adopted flexible/remote workingas required. I will be receiving and reading email as normal but I may not always be available on the office number.

[JBA COVID-19 statement]<https://www.jbagroup.co.uk/sites/www.jbagroup.co.uk/files/documents/15-030%20JBA%20Business%20Continuity%20Briefing%20-%20Latest.pdf>

T +44 (0) 1756 799919

[Visit our website]<http://www.jbarisk.com> [http://www.jbagroup.co.uk/imgstore/JBA-Email-Sig-Icons-LINKEDIN.png] <https://www.linkedin.com/in/jon-morris-a2897b4/>  [Follow us on Twitter] <https://twitter.com/jbarisk>
Our postal address and registered office is JBA Risk Management Limited, 1 Broughton Park, Old Lane North, Broughton, Skipton, North Yorkshire BD23 3FD.

Find out more about us here: www.jbarisk.com<http://www.jbarisk.com/> and follow us on Twitter @JBARisk<http://twitter.com/JBARisk> and LinkedIn<https://www.linkedin.com/company/2370847?trk=tyah&trkInfo=clickedVertical%3Acompany%2CclickedEntityId%3A2370847%2Cidx%3A2-1-2%2CtarId%3A1447414259786%2Ctas%3AJBA%20RISK%20MANAGEMENT>

The JBA Group supports the JBA Trust.

All JBA Risk Management's email messages contain confidential information and are intended only for the individual(s) named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by email if you have received this email by mistake and delete this email from your system.

JBA Risk Management Limited is registered in England, company number 07732946, 1 Broughton Park, Old Lane North, Broughton, Skipton, North Yorkshire, BD23 3FD, Telephone: +441756799919

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200608/50e622cd/attachment.html>

More information about the gdal-dev mailing list