diff options
author | Remi Collet <remi@php.net> | 2014-03-12 17:10:51 +0100 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2014-03-12 17:10:51 +0100 |
commit | 862c006da178e3bb2a247b76b19d72d338efc0bd (patch) | |
tree | b7366055f6bfe8e3a5be4894cab029ebe1132ca6 /ext/gd | |
parent | f2d5b2b6c657db29af3bc92d93645ff66574b56f (diff) | |
download | php-git-862c006da178e3bb2a247b76b19d72d338efc0bd.tar.gz |
Fix bug #66887 imagescale - poor quality of scaled image
Issue with signed char overflow.
Upstream fix:
https://bitbucket.org/libgd/gd-libgd/commits/4b86e06937bc5ff116be969137f8da9d1a7869d5
Diffstat (limited to 'ext/gd')
-rw-r--r-- | ext/gd/libgd/gd_interpolation.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c index 76327be7df..65e2360776 100644 --- a/ext/gd/libgd/gd_interpolation.c +++ b/ext/gd/libgd/gd_interpolation.c @@ -1324,8 +1324,8 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w gdFixed f_j = gd_itofx(j); gdFixed f_a = gd_mulfx(f_i, f_dy); gdFixed f_b = gd_mulfx(f_j, f_dx); - const long m = gd_fxtoi(f_a); - const long n = gd_fxtoi(f_b); + const gdFixed m = gd_fxtoi(f_a); + const gdFixed n = gd_fxtoi(f_b); gdFixed f_f = f_a - gd_itofx(m); gdFixed f_g = f_b - gd_itofx(n); @@ -1365,10 +1365,10 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w f_a3 = gd_itofx(gdTrueColorGetAlpha(pixel3)); f_a4 = gd_itofx(gdTrueColorGetAlpha(pixel4)); { - const char red = (char) gd_fxtoi(gd_mulfx(f_w1, f_r1) + gd_mulfx(f_w2, f_r2) + gd_mulfx(f_w3, f_r3) + gd_mulfx(f_w4, f_r4)); - const char green = (char) gd_fxtoi(gd_mulfx(f_w1, f_g1) + gd_mulfx(f_w2, f_g2) + gd_mulfx(f_w3, f_g3) + gd_mulfx(f_w4, f_g4)); - const char blue = (char) gd_fxtoi(gd_mulfx(f_w1, f_b1) + gd_mulfx(f_w2, f_b2) + gd_mulfx(f_w3, f_b3) + gd_mulfx(f_w4, f_b4)); - const char alpha = (char) gd_fxtoi(gd_mulfx(f_w1, f_a1) + gd_mulfx(f_w2, f_a2) + gd_mulfx(f_w3, f_a3) + gd_mulfx(f_w4, f_a4)); + const unsigned char red = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_r1) + gd_mulfx(f_w2, f_r2) + gd_mulfx(f_w3, f_r3) + gd_mulfx(f_w4, f_r4)); + const unsigned char green = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_g1) + gd_mulfx(f_w2, f_g2) + gd_mulfx(f_w3, f_g3) + gd_mulfx(f_w4, f_g4)); + const unsigned char blue = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_b1) + gd_mulfx(f_w2, f_b2) + gd_mulfx(f_w3, f_b3) + gd_mulfx(f_w4, f_b4)); + const unsigned char alpha = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_a1) + gd_mulfx(f_w2, f_a2) + gd_mulfx(f_w3, f_a3) + gd_mulfx(f_w4, f_a4)); new_img->tpixels[dst_offset_v][dst_offset_h] = gdTrueColorAlpha(red, green, blue, alpha); } |