Sf: R crashes with gdal_utils("translate", ...) - GDAL 3 - output VRT

Created on 9 Apr 2020  ·  2Comments  ·  Source: r-spatial/sf

Hi,
gdal_utils() causes R crashing when an output VRT is required and with GDAL >= 3.

Here a minimal example which is causing that:

sf::gdal_utils(
  "translate", 
  system.file("tif/L7_ETMs.tif", package = "stars"),
  tmpout <- tempfile(fileext = ".vrt"),
  options = c("-of", "VRT")
)

I verified it occurs when calling GDAL C codes:

sf:::CPL_gdaltranslate(
  system.file("tif/L7_ETMs.tif", package = "stars"),
  tmpout <- tempfile(fileext = ".vrt"),
  options = c("-of", "VRT"),
  oo = character(0)
)

The crash was verified on different OS:

> devtools::session_info()
─ Session info ───────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.3 (2020-02-29)
 os       Arch Linux                  
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language (EN)                        
 collate  it_IT.UTF-8                 
 ctype    it_IT.UTF-8                 
 tz       Europe/Rome                 
 date     2020-04-09                  

─ Packages ───────────────────────────────────────────────────────────────────
 package     * version date       lib source           
 rgdal       * 1.5-3   2020-01-29 [1] R-Forge (R 3.6.2)
 sf          * 0.9-2   2020-04-09 [1] local            

> sf::sf_extSoftVersion()
            GEOS           GDAL         proj.4 GDAL_with_GEOS     USE_PROJ_H
         "3.8.0"        "3.0.4"        "6.3.1"         "true"         "true"
> devtools::session_info()
─ Session info ───────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.3 (2020-02-29)
 os       Arch Linux                  
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language (EN)                        
 collate  it_IT.UTF-8                 
 ctype    it_IT.UTF-8                 
 tz       Europe/Rome                 
 date     2020-04-09                  

─ Packages ───────────────────────────────────────────────────────────────────
 package     * version date       lib source        
 rgdal       * 1.4-8   2019-11-27 [1] CRAN (R 3.6.3)
 sf          * 0.9-2   2020-04-09 [1] local         



md5-6dda8931e37212fac25b781253637364



> devtools::session_info()
─ Session info ───────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.2 (2019-12-12)
 os       Ubuntu 18.04.4 LTS          
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       Europe/Rome                 
 date     2020-04-09                  

─ Packages ───────────────────────────────────────────────────────────────────
 package         * version    date       lib source                                     
 sf              * 0.9-1      2020-04-06 [1] CRAN (R 3.6.2)                             

> sf::sf_extSoftVersion()
          GEOS           GDAL         proj.4 GDAL_with_GEOS     USE_PROJ_H
       "3.8.0"        "3.0.2"        "6.2.1"         "true"         "true" 



md5-5d779a2f6207ad69bc45acd172af5107



> devtools::session_info()
─ Session info ───────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.3 (2020-02-29)
 os       Ubuntu 18.04.4 LTS          
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language (EN)                        
 collate  it_IT.UTF-8                 
 ctype    it_IT.UTF-8                 
 tz       Europe/Rome                 
 date     2020-04-09                  

─ Packages ───────────────────────────────────────────────────────────────────
 package     * version date       lib source                       
 rgdal       * 1.4-8   2019-11-27 [1] CRAN (R 3.6.3)               
 sf          * 0.9-2   2020-04-09 [1] Github (r-spatial/sf@0b09452)

> sf::sf_extSoftVersion()
            GEOS           GDAL         proj.4 GDAL_with_GEOS     USE_PROJ_H
         "3.7.1"        "2.2.3"        "4.9.3"         "true"        "false"



md5-6dda8931e37212fac25b781253637364



> devtools::session_info()
- Session info ---------------------------------------------------------------
 setting  value                       
 version  R version 3.6.1 (2019-07-05)
 os       Windows Server >= 2012 x64  
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  Italian_Italy.1252          
 ctype    Italian_Italy.1252          
 tz       Europe/Berlin               
 date     2020-04-09                  

- Packages -------------------------------------------------------------------
 package     * version date       lib source                       
 rgdal       * 1.4-8   2019-11-27 [1] CRAN (R 3.6.1)               
 sf          * 0.9-2   2020-04-09 [1] Github (r-spatial/sf@0b09452)

> sf::sf_extSoftVersion()
            GEOS           GDAL         proj.4 GDAL_with_GEOS     USE_PROJ_H
         "3.6.1"        "2.2.3"        "4.9.3"         "true"        "false"

Thank you,

bug

Most helpful comment

I confirm the issue was fixed, thanks!

All 2 comments

Seems like a double free somewhere - this was not documented in the GDAL API.

I confirm the issue was fixed, thanks!

Was this page helpful?
0 / 5 - 0 ratings