That's just it, the library is not failing, it's doing exactly what it's supposed to. The issue is that it's slow at it, and consumes a ton of ram, hitting the PHP limits and it gets terminated.
A highly compressed PNG with large dimensions will do exactly the same thing.
> And what if I take a BMP file and patch the PNG magic number into it?
gd will bomb out and stop, the issue is that GD can and will load a BMP as it's a generic image processing library that PHP wraps.
At it's core, the issue is SMF's poor design, image thumbnail generation should be a background task done by the server, NOT as part of a HTTP request.