Fix segfault when loading 16-bit float tiff

This commit is contained in:
heckflosse
2018-08-31 13:01:27 +02:00
parent 5d1922ce56
commit 258dfc2275

View File

@@ -153,7 +153,8 @@ public:
if (exponent == 0) {
if (mantissa == 0) {
// Plus or minus zero
return (uint32_t) (sign << 31);
tmp.i = (uint32_t) (sign << 31);
return tmp.f;
} else {
// Denormalized number -- renormalize it
while (!(mantissa & 0x00000400)) {
@@ -166,7 +167,8 @@ public:
} else if (exponent == 31) {
if (mantissa == 0) {
// Positive or negative infinity, convert to maximum (16 bit) values.
return (uint32_t) ((sign << 31) | ((0x1eL + 127 - 15) << 23) | (0x3ffL << 13));
tmp.i = (uint32_t)((sign << 31) | ((0x1eL + 127 - 15) << 23) | (0x3ffL << 13));
return tmp.f;
} else {
// Nan -- Just set to zero.
return 0;