Repository navigation
Conversation
|
OK I have learnt a few important things since originally submitting this:
|
|
How important it is to use PyDateTime_TIME_GET_TZINFO, if it is not necessarily available, and if in that case something else must be used? Can't you use just a single path but still prevent segfault? |
|
thanks @jratike80 just updated the title to make it a bit clearer. Important thing is to check the |
|
You still mention using the macro in the description. Does the change affect only raster attribute tables, or more generally datetime handling in GDAL? |
|
Ah right, description updated - thanks. No, this is very specific to Raster Attribute Tables. |
What does this PR do?
It fixes a seg fault when writing datetime Raster Attribute Table columns using the Python bindings when no timezone was supplied. Previously, the code expected the timezone to be
Noneif not present. However Python uses a different Cstructto represent the datetime if no datetime is present. Instead the code needs to check thehastzinfofield before attempting to access the timezone, otherwise it could be accessing beyond the end of thestruct.I looked at using Python's C macros to help, but there seemed to nothing specific for the datetime type.
What are related issues/pull requests?
AI tool usage
Not used.
Tasklist