gd-CVE-2019-6977.patch 729 B

12345678910111213141516
  1. Index: libgd-2.2.5/src/gd_color_match.c
  2. ===================================================================
  3. --- libgd-2.2.5.orig/src/gd_color_match.c 2019-01-31 12:56:44.944336318 +0100
  4. +++ libgd-2.2.5/src/gd_color_match.c 2019-01-31 12:58:11.368836899 +0100
  5. @@ -31,8 +31,8 @@ BGD_DECLARE(int) gdImageColorMatch (gdIm
  6. return -4; /* At least 1 color must be allocated */
  7. }
  8. - buf = (unsigned long *)gdMalloc(sizeof(unsigned long) * 5 * im2->colorsTotal);
  9. - memset (buf, 0, sizeof(unsigned long) * 5 * im2->colorsTotal );
  10. + buf = (unsigned long *)gdMalloc(sizeof(unsigned long) * 5 * gdMaxColors);
  11. + memset (buf, 0, sizeof(unsigned long) * 5 * gdMaxColors );
  12. for (x=0; x < im1->sx; x++) {
  13. for( y=0; y<im1->sy; y++ ) {