Corrupt image files can request silly amounts of memory even if they don't overflow a size_t, which generally causes a bad_alloc to be thrown by new[]. This is not reliably caught today, and in some cases can propagate to the end of main() and causes an ugly error to get printed. Hoist a single check for those somewhere in common code that can catch all input image allocations.
Need to catch:
- load_cimage
- load_ncimage
- load_ktx_compressed_image
Corrupt image files can request silly amounts of memory even if they don't overflow a
size_t, which generally causes a bad_alloc to be thrown by new[]. This is not reliably caught today, and in some cases can propagate to the end ofmain()and causes an ugly error to get printed. Hoist a single check for those somewhere in common code that can catch all input image allocations.Need to catch: