#1712 closed defect (fixed)
Problems writing rasters with NG Python on 64 bit machines
Reported by: | Sam Gillingham | Owned by: | warmerdam |
---|---|---|---|
Priority: | high | Milestone: | 1.4.3 |
Component: | PythonBindings | Version: | 1.4.2 |
Severity: | normal | Keywords: | 64bit |
Cc: | hobu |
Description
in gdal_wrap.cpp, both _wrap_Dataset_WriteRaster and _wrap_Band_WriteRaster contain code like this:
PyString_AsStringAndSize(obj5, &arg7, ( Py_ssize_t*)&arg6 );
Where arg6 is an integer. On a 64 bit machine, int is 32 bits while a pointer is 64. So, this cast is not valid because they are different sizes. This may well work on a little endian machine, but on a big endian machine, the 'wrong' part of the pointer gets written to the int (which is zero) and the bindings fail to write anything.
A proposed workaround patch (against 1.4.2) is supplied.
This makes me wonder if using 'int' as a size is a good idea - what happens if I want to write a raster > 4GB?
Thanks,
Sam.
Attachments (1)
Change History (4)
by , 17 years ago
Attachment: | gdal_wrap_64patch.cpp added |
---|
comment:1 by , 17 years ago
Cc: | added |
---|---|
Owner: | changed from | to
I'll take this since I have a convenient test environment for the ticket.
comment:2 by , 17 years ago
Keywords: | 64bit added |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Proposed 64 bit workaround