GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
On platforms where char is actually signed char an integer overflow can happen in gdImageScaleBilinearPalette due to sign extension when red, green and blue are passed to gdTrueColorAlpha().
gdImagePtr src, dst;
src = gdImageCreate(100, 100);
gdImageColorAllocate(src, 255, 255, 255);
dst = gdImageScale(src, 200, 200);
printf("color: %d\n", gdImageGetPixel(dst, 99, 99));
Fix #330: Integer overflow in gdImageScaleBilinearPalette()
The color components are supposed to be in range 0..255, so we must not
cast them to `signed char`, what can be the default for `char`.
(cherry picked from commit 77c8d35)