-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raster MEM driver: disable opening a dataset with MEM::: syntax by default #10861
Conversation
rouault
commented
Sep 22, 2024
…fault ``` Starting with GDAL 3.10, opening a MEM dataset using the above syntax is no longer enabled by default for security reasons. If you want to allow it, define the ``GDAL_MEM_ENABLE_OPEN`` configuration option to ``YES``, or build GDAL with the ``GDAL_MEM_ENABLE_OPEN`` compilation definition. .. config:: GDAL_MEM_ENABLE_OPEN :choices: YES, NO :default: NO :since: 3.10 Whether opening a MEM dataset with the ``MEM:::`` syntax is allowed. ```
@mdsumner Ah, so they are people using that outside of GDAL. Interesting. An alternative to opening with "MEM:::DATAPOINTER=..." is to use the GDALCreate() function on the MEM driver, creating 0 bands. The unsafe part of the "MEM:::DATAPOINTER=..." open syntax is that it could be used in a hostile context as a tile name of a virtual mosaic format to causes crashes or worse. |
@sgillies ok, I see rasterio/rasterio uses that at https://github.com/rasterio/rasterio/blob/ffe77ecc7bd0f92597e6ca700e0987f33ba8f0f9/rasterio/_io.pyx#L2256 . |
I think in R the people is me-only. :) Useful for exploring warper output on crafted matrices. Appreciate the heads up about how I should provide it. The other case I saw it being used (slightly) outside of rasterio: https://gist.github.com/vincentsarago/b00f50f8b66ab5ccbd4449f6a1bd8b71 |
Hello, we are also using it in OrfeoToolBox (if changes can help, you can look here https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/merge_requests/1056 ) Also I was wondering: now how do you open a dataset with the "GA_ReadOnly" or "GA_Update" ? |
The former for read-only scenarios, the later for read-update ones |
Thank you, but that was not want I wanted to know, maybe my previous question is confuse. |
Ah I see. You can't. Datasets returned by Create() are assumed to be read-write. If you provide a read-only memory mapping, you should be careful not to call RasterIO(GF_Write, ...) or another method that can alter pixel values. That's admitedly an oversight |
Ok, thank you for the clarification! Indeed the Maybe the best way to do it in our code is to provide one read-only wrapper method which returns a const DataSet and one R/W method which returns a writable dataset. |