OpenImageIO/oiio — pull request #998 by luhk (2014-11-20 21:03:30+00:00)
Title: Fix segfault in python ImageInput.read_* functions

which happens when calling one of the ImageInput.read_* functions
without specifying a type/format.

The reason:
When not specified, the format would be TypeDesc::UNKNOWN. So, calling
format.size() to determine how much memory to allocate will (probably)
not work.

The subsequent call to the C++ read_* function will further return the
image data in the native format, which will not work together with
C_array_to_Python_array(), which assumes float if format is
TypeDesc::UNKNOWN.

This commit sets format to spec.format (i. e. the native format) if
format is TypeDesc::UNKNOWN to match the behavior of the C++ functions
(i. e. return data in native format).

For me, this fixes read_scanline and read_image, I have no tiled images to test read_tile.