Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 27 by
eric.p...@gmail.com: Writing a field with an empty string
segfault with the C wrapper
http://code.google.com/p/pylibtiff/issues/detail?id=27
What steps will reproduce the problem?
>>> from libtiff import TIFF
>>> import numpy
>>> tif = TIFF.open('filename.tif', mode='w')
>>> tif.SetField("ImageDescription", "")
Segmentation fault (core dumped)
What is the expected output? What do you see instead?
>>> from libtiff import TIFF
>>> import numpy
>>> tif = TIFF.open('filename.tif', mode='w')
>>> tif.SetField("ImageDescription", "")
>>> tif.write_image(numpy.zeros((20,20)))
>>> tif.close()
$ tiffinfo filename.tif
TIFF Directory at offset 0xc88 (3208)
Image Width: 20 Image Length: 20
Bits/Sample: 64
Sample Format: IEEE floating point
Compression Scheme: None
Photometric Interpretation: min-is-black
Orientation: row 0 top, col 0 lhs
Planar Configuration: single image plane
ImageDescription:
What version of the product are you using? On what operating system?
svn HEAD (rev 93) (on Ubuntu 12.04)
Please provide any additional information below.
This is due to the SetField() wrapper which is confused because Python
strings are iterable, but ctype needs to convert them as a simple type.
Attached is a patch that fixes this. This patch can also be found here:
https://github.com/delmic/pylibtiff/commit/9bbdd48321dacbe0be418adf77c2cc063c3558ab
PS: the patch also fixes a few other minor issues, let me know if you
prefer a patch which does only the very minimum to fix this issue.
Attachments:
0001-Fix-TIFF.SetField-with-empty-strings-segfaulting.patch 6.9 KB
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings