Opened 12 months ago

Closed 12 months ago

Last modified 12 months ago

#7176 closed defect (fixed)

gdal_rasterize crash with all touched and specific extent in Mollweide projection

Reported by: maffelu Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: 2.2.2
Severity: normal Keywords: gdal_rasterize
Cc:

Description (last modified by maffelu)

gdal_rasterize is crashing when trying to rasterize the shapefile in attachment, with a specific extent and the all touched option.

The error is: gdal_rasterize: double free or corruption

gdal_rasterize -at -a PolyID -te -7277250 5104250 -7252250 5118250 -tr 250 250 -ot UInt32 test_wm_single_failing_polygon.shp PolyID_raster.tif --debug on
GNM: GNMRegisterAllInternal
GNM: RegisterGNMFile
GNM: RegisterGNMdatabase
GDAL: GDALOpen(test_wm_single_failing_polygon.shp, this=0xd57f70) succeeds as ESRI Shapefile.
GDAL: GDALDriver::Create(GTiff,PolyID_raster.tif,100,56,1,UInt32,(nil))
GDAL: Rasterizer operating on 1 swaths of 56 scanlines.
0GDAL: GDAL_CACHEMAX = 12911 MB
...10...20...30...40...50...60...70...80...90...100 - done.
*** glibc detected *** gdal_rasterize: double free or corruption (out): 0x0000000000d85c20 ***
======= Backtrace: =========
/lib64/libc.so.6[0x33c9075dee]
/lib64/libc.so.6[0x33c9078c80]
/usr/local/lib/libgdal.so.20(GDALRasterizeGeometries+0x22a)[0x7f00e0faef1a]
/usr/local/lib/libgdal.so.20(+0x4deb73)[0x7f00e0fe2b73]
/usr/local/lib/libgdal.so.20(GDALRasterize+0xb26)[0x7f00e0fe3a56]
gdal_rasterize[0x401518]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x33c901ed1d]
gdal_rasterize[0x401139]
======= Memory map: ========
00400000-00402000 r-xp 00000000 fd:01 16990                              /usr/local/bin/gdal_rasterize
00602000-00603000 rw-p 00002000 fd:01 16990                              /usr/local/bin/gdal_rasterize
00cf6000-00db1000 rw-p 00000000 00:00 0                                  [heap]
33c8c00000-33c8c20000 r-xp 00000000 fd:01 1672                           /lib64/ld-2.12.so
33c8e20000-33c8e21000 r--p 00020000 fd:01 1672                           /lib64/ld-2.12.so
33c8e21000-33c8e22000 rw-p 00021000 fd:01 1672                           /lib64/ld-2.12.so
33c8e22000-33c8e23000 rw-p 00000000 00:00 0
33c9000000-33c918a000 r-xp 00000000 fd:01 6203                           /lib64/libc-2.12.so
33c918a000-33c938a000 ---p 0018a000 fd:01 6203                           /lib64/libc-2.12.so
33c938a000-33c938e000 r--p 0018a000 fd:01 6203                           /lib64/libc-2.12.so
33c938e000-33c9390000 rw-p 0018e000 fd:01 6203                           /lib64/libc-2.12.so
33c9390000-33c9394000 rw-p 00000000 00:00 0
33c9400000-33c9441000 r-xp 00000000 fd:01 19118                          /usr/lib64/libproj.so.0.6.6
33c9441000-33c9640000 ---p 00041000 fd:01 19118                          /usr/lib64/libproj.so.0.6.6
33c9640000-33c9643000 rw-p 00040000 fd:01 19118                          /usr/lib64/libproj.so.0.6.6
33c9800000-33c9802000 r-xp 00000000 fd:01 34854                          /lib64/libdl-2.12.so
33c9802000-33c9a02000 ---p 00002000 fd:01 34854                          /lib64/libdl-2.12.so
33c9a02000-33c9a03000 r--p 00002000 fd:01 34854                          /lib64/libdl-2.12.so
33c9a03000-33c9a04000 rw-p 00003000 fd:01 34854                          /lib64/libdl-2.12.so
33c9c00000-33c9c83000 r-xp 00000000 fd:01 11530                          /lib64/libm-2.12.so
33c9c83000-33c9e82000 ---p 00083000 fd:01 11530                          /lib64/libm-2.12.so
33c9e82000-33c9e83000 r--p 00082000 fd:01 11530                          /lib64/libm-2.12.so
33c9e83000-33c9e84000 rw-p 00083000 fd:01 11530                          /lib64/libm-2.12.so
33ca000000-33ca015000 r-xp 00000000 fd:01 42                             /lib64/libz.so.1.2.3
33ca015000-33ca214000 ---p 00015000 fd:01 42                             /lib64/libz.so.1.2.3
33ca214000-33ca215000 r--p 00014000 fd:01 42                             /lib64/libz.so.1.2.3
33ca215000-33ca216000 rw-p 00015000 fd:01 42                             /lib64/libz.so.1.2.3
33ca400000-33ca54f000 r-xp 00000000 fd:01 19111                          /usr/lib64/libpodofo.so.0.9.1
33ca54f000-33ca74e000 ---p 0014f000 fd:01 19111                          /usr/lib64/libpodofo.so.0.9.1
33ca74e000-33ca75d000 rw-p 0014e000 fd:01 19111                          /usr/lib64/libpodofo.so.0.9.1
33ca75d000-33ca762000 rw-p 00000000 00:00 0
33cac00000-33cac1d000 r-xp 00000000 fd:01 5249                           /lib64/libselinux.so.1
33cac1d000-33cae1c000 ---p 0001d000 fd:01 5249                           /lib64/libselinux.so.1
33cae1c000-33cae1d000 r--p 0001c000 fd:01 5249                           /lib64/libselinux.so.1
33cae1d000-33cae1e000 rw-p 0001d000 fd:01 5249                           /lib64/libselinux.so.1
33cae1e000-33cae1f000 rw-p 00000000 00:00 0
33cb000000-33cb016000 r-xp 00000000 fd:01 11510                          /lib64/libresolv-2.12.so
33cb016000-33cb216000 ---p 00016000 fd:01 11510                          /lib64/libresolv-2.12.so
33cb216000-33cb217000 r--p 00016000 fd:01 11510                          /lib64/libresolv-2.12.so
33cb217000-33cb218000 rw-p 00017000 fd:01 11510                          /lib64/libresolv-2.12.so
33cb218000-33cb21a000 rw-p 00000000 00:00 0
33ccc00000-33ccc26000 r-xp 00000000 fd:01 2823                           /lib64/libexpat.so.1.5.2
33ccc26000-33cce25000 ---p 00026000 fd:01 2823                           /lib64/libexpat.so.1.5.2
33cce25000-33cce28000 rw-p 00025000 fd:01 2823                           /lib64/libexpat.so.1.5.2
33cd000000-33cd098000 r-xp 00000000 fd:01 130                            /usr/lib64/libfreetype.so.6.3.22
33cd098000-33cd297000 ---p 00098000 fd:01 130                            /usr/lib64/libfreetype.so.6.3.22
33cd297000-33cd29d000 rw-p 00097000 fd:01 130                            /usr/lib64/libfreetype.so.6.3.22
33cd400000-33cd434000 r-xp 00000000 fd:01 42303                          /usr/lib64/libfontconfig.so.1.4.4
33cd434000-33cd634000 ---p 00034000 fd:01 42303                          /usr/lib64/libfontconfig.so.1.4.4
33cd634000-33cd636000 rw-p 00034000 fd:01 42303                          /usr/lib64/libfontconfig.so.1.4.4
33cd800000-33cd825000 r-xp 00000000 fd:01 121                            /usr/lib64/libpng12.so.0.49.0
33cd825000-33cda25000 ---p 00025000 fd:01 121                            /usr/lib64/libpng12.so.0.49.0
33cda25000-33cda26000 rw-p 00025000 fd:01 121                            /usr/lib64/libpng12.so.0.49.0
33ce400000-33ce453000 r-xp 00000000 fd:01 29695                          /usr/lib64/libcurl.so.4.1.1
33ce453000-33ce652000 ---p 00053000 fd:01 29695                          /usr/lib64/libcurl.so.4.1.1
33ce652000-33ce655000 rw-p 00052000 fd:01 29695                          /usr/lib64/libcurl.so.4.1.1
33cf800000-33cf816000 r-xp 00000000 fd:01 2990                           /lib64/libgcc_s-4.4.7-20120601.so.1
33cf816000-33cfa15000 ---p 00016000 fd:01 2990                           /lib64/libgcc_s-4.4.7-20120601.so.1
33cfa15000-33cfa16000 rw-p 00015000 fd:01 2990                           /lib64/libgcc_s-4.4.7-20120601.so.1
33cfc00000-33cfce8000 r-xp 00000000 fd:01 42312                          /usr/lib64/libstdc++.so.6.0.13
33cfce8000-33cfee8000 ---p 000e8000 fd:01 42312                          /usr/lib64/libstdc++.so.6.0.13
33cfee8000-33cfeef000 r--p 000e8000 fd:01 42312                          /usr/lib64/libstdc++.so.6.0.13
33cfeef000-33cfef1000 rw-p 000ef000 fd:01 42312                          /usr/lib64/libstdc++.so.6.0.13
33cfef1000-33cff06000 rw-p 00000000 00:00 0
33d0400000-33d0454000 r-xp 00000000 fd:01 66353                          /lib64/libldap_r-2.4.so.2.10.3
33d0454000-33d0654000 ---p 00054000 fd:01 66353                          /lib64/libldap_r-2.4.so.2.10.3
33d0654000-33d0656000 r--p 00054000 fd:01 66353                          /lib64/libldap_r-2.4.so.2.10.3
33d0656000-33d0658000 rw-p 00056000 fd:01 66353                          /lib64/libldap_r-2.4.so.2.10.3
33d0658000-33d065a000 rw-p 00000000 00:00 0
33d0800000-33d09ba000 r-xp 00000000 fd:01 64608                          /usr/lib64/libcrypto.so.1.0.1e
33d09ba000-33d0bba000 ---p 001ba000 fd:01 64608                          /usr/lib64/libcrypto.so.1.0.1e
33d0bba000-33d0bd5000 r--p 001ba000 fd:01 64608                          /usr/lib64/libcrypto.so.1.0.1e
33d0bd5000-33d0be1000 rw-p 001d5000 fd:01 64608                          /usr/lib64/libcrypto.so.1.0.1e
33d0be1000-33d0be5000 rw-p 00000000 00:00 0
33d1000000-33d1149000 r-xp 00000000 fd:01 13611                          /usr/lib64/libxml2.so.2.7.6
33d1149000-33d1348000 ---p 00149000 fd:01 13611                          /usr/lib64/libxml2.so.2.7.6
33d1348000-33d1352000 rw-p 00148000 fd:01 13611                          /usr/lib64/libxml2.so.2.7.6
33d1352000-33d1353000 rw-p 00000000 00:00 0
33d1400000-33d1403000 r-xp 00000000 fd:01 64596                          /lib64/libcom_err.so.2.1
33d1403000-33d1602000 ---p 00003000 fd:01 64596                          /lib64/libcom_err.so.2.1
33d1602000-33d1603000 r--p 00002000 fd:01 64596                          /lib64/libcom_err.so.2.1
33d1603000-33d1604000 rw-p 00003000 fd:01 64596                          /lib64/libcom_err.so.2.1
33d1800000-33d1802000 r-xp 00000000 fd:01 63420                          /lib64/libkeyutils.so.1.3
33d1802000-33d1a01000 ---p 00002000 fd:01 63420                          /lib64/libkeyutils.so.1.3
33d1a01000-33d1a02000 r--p 00001000 fd:01 63420                          /lib64/libkeyutils.so.1.3
33d1a02000-33d1a03000 rw-p 00002000 fd:01 63420                          /lib64/libkeyutils.so.1.3
33d1c00000-33d1c0a000 r-xp 00000000 fd:01 63421                          /lib64/libkrb5support.so.0.1
33d1c0a000-33d1e09000 ---p 0000a000 fd:01 63421                          /lib64/libkrb5support.so.0.1
33d1e09000-33d1e0a000 r--p 00009000 fd:01 63421                          /lib64/libkrb5support.so.0.1
33d1e0a000-33d1e0b000 rw-p 0000a000 fd:01 63421                          /lib64/libkrb5support.so.0.1
33d2800000-33d2829000 r-xp 00000000 fd:01 63422                          /lib64/libk5crypto.so.3.1
33d2829000-33d2a29000 ---p 00029000 fd:01 63422                          /lib64/libk5crypto.so.3.1
33d2a29000-33d2a2a000 r--p 00029000 fd:01 63422                          /lib64/libk5crypto.so.3.1
33d2a2a000-33d2a2b000 rw-p 0002a000 fd:01 63422                          /lib64/libk5crypto.so.3.1
33d2a2b000-33d2a2c000 rw-p 00000000 00:00 0
33d2c00000-33d2c41000 r-xp 00000000 fd:01 64599                          /lib64/libgssapi_krb5.so.2.2
33d2c41000-33d2e41000 ---p 00041000 fd:01 64599                          /lib64/libgssapi_krb5.so.2.2
33d2e41000-33d2e42000 r--p 00041000 fd:01 64599                          /lib64/libgssapi_krb5.so.2.2
33d2e42000-33d2e44000 rw-p 00042000 fd:01 64599                          /lib64/libgssapi_krb5.so.2.2
33d3000000-33d30dc000 r-xp 00000000 fd:01 64598                          /lib64/libkrb5.so.3.3
33d30dc000-33d32db000 ---p 000dc000 fd:01 64598                          /lib64/libkrb5.so.3.3
33d32db000-33d32e5000 r--p 000db000 fd:01 64598                          /lib64/libkrb5.so.3.3
33d32e5000-33d32e7000 rw-p 000e5000 fd:01 64598                          /lib64/libkrb5.so.3.3
33d3400000-33d3462000 r-xp 00000000 fd:01 64625                          /usr/lib64/libssl.so.1.0.1e
33d3462000-33d3662000 ---p 00062000 fd:01 64625                          /usr/lib64/libssl.so.1.0.1e
33d3662000-33d3666000 r--p 00062000 fd:01 64625                          /usr/lib64/libssl.so.1.0.1e
33d3666000-33d366c000 rw-p 00066000 fd:01 64625                          /usr/lib64/libssl.so.1.0.1e
33d7c00000-33d7ca9000 r-xp 00000000 fd:01 3009                           /usr/lib64/libsqlite3.so.0.8.6
33d7ca9000-33d7ea9000 ---p 000a9000 fd:01 3009                           /usr/lib64/libsqlite3.so.0.8.6
33d7ea9000-33d7ead000 rw-p 000a9000 fd:01 3009                           /usr/lib64/libsqlite3.so.0.8.6
33d8400000-33d8402000 r-xp 00000000 fd:01 10662                          /lib64/libfreebl3.so
33d8402000-33d8601000 ---p 00002000 fd:01 10662                          /lib64/libfreebl3.so
33d8601000-33d8602000 r--p 00001000 fd:01 10662                          /lib64/libfreebl3.so
33d8602000-33d8603000 rw-p 00002000 fd:01 10662                          /lib64/libfreebl3.so
33d8800000-33d8832000 r-xp 00000000 fd:01 11683                          /lib64/libidn.so.11.6.1
33d8832000-33d8a31000 ---p 00032000 fd:01 11683                          /lib64/libidn.so.11.6.1
33d8a31000-33d8a32000 rw-p 00031000 fd:01 11683                          /lib64/libidn.so.11.6.1
33d9a00000-33d9a07000 r-xp 00000000 fd:01 63185                          /lib64/libcrypt-2.12.so
33d9a07000-33d9c07000 ---p 00007000 fd:01 63185                          /lib64/libcrypt-2.12.so
33d9c07000-33d9c08000 r--p 00007000 fd:01 63185                          /lib64/libcrypt-2.12.so
33d9c08000-33d9c09000 rw-p 00008000 fd:01 63185                          /lib64/libcrypt-2.12.so
33d9c09000-33d9c37000 rw-p 00000000 00:00 0
33da800000-33da803000 r-xp 00000000 fd:01 43721                          /lib64/libplds4.so
33da803000-33daa02000 ---p 00003000 fd:01 43721                          /lib64/libplds4.so
33daa02000-33daa03000 r--p 00002000 fd:01 43721                          /lib64/libplds4.so
33daa03000-33daa04000 rw-p 00003000 fd:01 43721                          /lib64/libplds4.so
33dac00000-33dac62000 r-xp 00000000 fd:01 19193                          /usr/lib64/libtiff.so.3.9.4
33dac62000-33dae62000 ---p 00062000 fd:01 19193                          /usr/lib64/libtiff.so.3.9.4
33dae62000-33dae65000 rw-p 00062000 fd:01 19193                          /usr/lib64/libtiff.so.3.9.4
33db400000-33db43f000 r-xp 00000000 fd:01 35                             /usr/lib64/libjpeg.so.62.0.0
33db43f000-33db63f000 ---p 0003f000 fd:01 35                             /usr/lib64/libjpeg.so.62.0.0
33db63f000-33db640000 rw-p 0003f000 fd:01 35                             /usr/lib64/libjpeg.so.62.0.0
33db640000-33db650000 rw-p 00000000 00:00 0
33db800000-33db93a000 r-xp 00000000 fd:01 53398                          /usr/lib64/libnss3.so
33db93a000-33dbb39000 ---p 0013a000 fd:01 53398                          /usr/lib64/libnss3.so
33dbb39000-33dbb3f000 r--p 00139000 fd:01 53398                          /usr/lib64/libnss3.so
33dbb3f000-33dbb41000 rw-p 0013f000 fd:01 53398                          /usr/lib64/libnss3.so
33dbb41000-33dbb43000 rw-p 00000000 00:00 0
33dbc00000-33dbc39000 r-xp 00000000 fd:01 43684                          /lib64/libnspr4.so
33dbc39000-33dbe39000 ---p 00039000 fd:01 43684                          /lib64/libnspr4.so
33dbe39000-33dbe3a000 r--p 00039000 fd:01 43684                          /lib64/libnspr4.so
33dbe3a000-33dbe3c000 rw-p 0003a000 fd:01 43684                          /lib64/libnspr4.so
33dbe3c000-33dbe3e000 rw-p 00000000 00:00 0
33dc000000-33dc004000 r-xp 00000000 fd:01 43700                          /lib64/libplc4.so
33dc004000-33dc203000 ---p 00004000 fd:01 43700                          /lib64/libplc4.so
33dc203000-33dc204000 r--p 00003000 fd:01 43700                          /lib64/libplc4.so
33dc204000-33dc205000 rw-p 00004000 fd:01 43700                          /lib64/libplc4.so
33dc400000-33dc428000 r-xp 00000000 fd:01 63183                          /usr/lib64/libsmime3.so
33dc428000-33dc627000 ---p 00028000 fd:01 63183                          /usr/lib64/libsmime3.so
33dc627000-33dc62b000 r--p 00027000 fd:01 63183                          /usr/lib64/libsmime3.so
33dc62b000-33dc62c000 rw-p 0002b000 fd:01 63183                          /usr/lib64/libsmime3.so
33dc800000-33dc847000 r-xp 00000000 fd:01 53400                          /usr/lib64/libssl3.so
33dc847000-33dca47000 ---p 00047000 fd:01 53400                          /usr/lib64/libssl3.so
33dca47000-33dca4b000 r--p 00047000 fd:01 53400                          /usr/lib64/libssl3.so
33dca4b000-33dca4c000 rw-p 0004b000 fd:01 53400                          /usr/lib64/libssl3.so
33dca4c000-33dca4d000 rw-p 00000000 00:00 0
33dcc00000-33dcc19000 r-xp 00000000 fd:01 66346                          /usr/lib64/libsasl2.so.2.0.23
33dcc19000-33dce18000 ---p 00019000 fd:01 66346                          /usr/lib64/libsasl2.so.2.0.23
33dce18000-33dce19000 r--p 00018000 fd:01 66346                          /usr/lib64/libsasl2.so.2.0.23
33dce19000-33dce1a000 rw-p 00019000 fd:01 66346                          /usr/lib64/libsasl2.so.2.0.23
33dd000000-33dd00e000 r-xp 00000000 fd:01 16438                          /lib64/liblber-2.4.so.2.10.3
33dd00e000-33dd20d000 ---p 0000e000 fd:01 16438                          /lib64/liblber-2.4.so.2.10.3
33dd20d000-33dd20e000 r--p 0000d000 fd:01 16438                          /lib64/liblber-2.4.so.2.10.3
33dd20e000-33dd20f000 rw-p 0000e000 fd:01 16438                          /lib64/liblber-2.4.so.2.10.3
33dd400000-33dd44e000 r-xp 00000000 fd:01 19172                          /lib64/libldap-2.4.so.2.10.3Aborted (core dumped)

The same command works fine if I change the maxy of the extent from 5118250 to 5118500:

gdal_rasterize -at -a PolyID -te -7277250 5104250 -7252250 5118500 -tr 250 250 -ot UInt32 test_wm_single_failing_polygon.shp PolyID_raster_OK.tif --debug on
GNM: GNMRegisterAllInternal
GNM: RegisterGNMFile
GNM: RegisterGNMdatabase
GDAL: GDALOpen(test_wm_single_failing_polygon.shp, this=0x1900f70) succeeds as ESRI Shapefile.
GDAL: GDALDriver::Create(GTiff,PolyID_raster_OK.tif,100,57,1,UInt32,(nil))
GDAL: Rasterizer operating on 1 swaths of 57 scanlines.
0GDAL: GDAL_CACHEMAX = 12911 MB
...10...20...30...40...50...60...70...80...90...100 - done.
Shape: 1 features read on layer 'test_wm_single_failing_polygon'.
GDAL: GDALClose(test_wm_single_failing_polygon.shp, this=0x1900f70)
GTiff: Adjusted bytes to write from 8000 to 6800.
GDAL: GDALClose(PolyID_raster_OK.tif, this=0x192dab0)

Oddly the output is created in both commands. Here the situation loaded in QGIS:

Screenshot

The red is the failing rasterization, with maxy 5118250, and we can see maxy is very close to the upper edge of the polygon. The green is the working one, with maxy 5118500. It seems the relative positions of the maxy and the polygon points is the cause of the problem.

I run the command on a CentOS release 6.9 (Final), but the same issue appears on Windows 10, just with less info displayed.

Attachments (5)

test_wm_single_failing_polygon.shp (412 bytes) - added by maffelu 12 months ago.
test_wm_single_failing_polygon.dbf (444 bytes) - added by maffelu 12 months ago.
test_wm_single_failing_polygon.prj (325 bytes) - added by maffelu 12 months ago.
test_wm_single_failing_polygon.shx (108 bytes) - added by maffelu 12 months ago.
QGIS_screenshot.png (80.9 KB) - added by maffelu 12 months ago.
Screenshot

Download all attachments as: .zip

Change History (8)

Changed 12 months ago by maffelu

Changed 12 months ago by maffelu

Changed 12 months ago by maffelu

Changed 12 months ago by maffelu

Changed 12 months ago by maffelu

Attachment: QGIS_screenshot.png added

Screenshot

comment:1 Changed 12 months ago by maffelu

Description: modified (diff)

comment:2 Changed 12 months ago by Even Rouault

Resolution: fixed
Status: newclosed

In 41012:

gdal_rasterize: fix crash in some situations with ALL_TOUCHED option (fixes #7176)

comment:3 Changed 12 months ago by Even Rouault

In 41013:

gdal_rasterize: fix crash in some situations with ALL_TOUCHED option (fixes #7176)

Note: See TracTickets for help on using tickets.