+ // guard against integer overflow during multiplication which could result
+ // in allocating a too small buffer and then overflowing it
+ const double bytesNeeded = (double)w * (double)h * sizeof(uint32);
+ if ( bytesNeeded >= wxUINT32_MAX )
+ {
+ if ( verbose )
+ {
+ wxLogError( _("TIFF: Image size is abnormally big.") );
+ }
+
+ TIFFClose(tif);
+
+ return false;
+ }