Fixed bug #86.
https://bitbucket.org/libgd/gd-libgd/issue/86/gdimagescale-segfaults-with-most