From b4e3dcda6cdb6182ef63e1f01b21ac53e5aed1b3 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 19 Jan 2017 09:38:12 +0100 Subject: [PATCH] v2.2.4 --- .gitignore | 1 + gd-2.2.3-dynamicGetbuf-negative-rlen.patch | 26 --------- gd-2.2.3-overflow-in-gdImageWebpCtx.patch | 33 ------------ gd-2.2.4-upstream.patch | 50 ++++++++++++++++++ ...lid-read-in-gdImageCreateFromTiffPtr.patch | Bin 10937 -> 0 bytes gd.spec | 33 +++++++----- sources | 2 +- 7 files changed, 73 insertions(+), 72 deletions(-) delete mode 100644 gd-2.2.3-dynamicGetbuf-negative-rlen.patch delete mode 100644 gd-2.2.3-overflow-in-gdImageWebpCtx.patch create mode 100644 gd-2.2.4-upstream.patch delete mode 100644 gd-2.2.x-fix-invalid-read-in-gdImageCreateFromTiffPtr.patch diff --git a/.gitignore b/.gitignore index ab5574d..60452a2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ gd-2.0.35.tar.bz2 /libgd-2.2.1.tar.xz /libgd-2.2.2.tar.xz /libgd-2.2.3.tar.xz +/libgd-2.2.4.tar.xz diff --git a/gd-2.2.3-dynamicGetbuf-negative-rlen.patch b/gd-2.2.3-dynamicGetbuf-negative-rlen.patch deleted file mode 100644 index 24ebd9b..0000000 --- a/gd-2.2.3-dynamicGetbuf-negative-rlen.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 53110871935244816bbb9d131da0bccff734bfe9 Mon Sep 17 00:00:00 2001 -From: "Christoph M. Becker" -Date: Wed, 12 Oct 2016 11:15:32 +0200 -Subject: [PATCH] Avoid potentially dangerous signed to unsigned conversion - -We make sure to never pass a negative `rlen` as size to memcpy(). See -also . - -Patch provided by Emmanuel Law. ---- - src/gd_io_dp.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/gd_io_dp.c b/src/gd_io_dp.c -index 135eda3..228bfa5 100644 ---- a/src/gd_io_dp.c -+++ b/src/gd_io_dp.c -@@ -276,7 +276,7 @@ static int dynamicGetbuf(gdIOCtxPtr ctx, void *buf, int len) - if(remain >= len) { - rlen = len; - } else { -- if(remain == 0) { -+ if(remain <= 0) { - /* 2.0.34: EOF is incorrect. We use 0 for - * errors and EOF, just like fileGetbuf, - * which is a simple fread() wrapper. diff --git a/gd-2.2.3-overflow-in-gdImageWebpCtx.patch b/gd-2.2.3-overflow-in-gdImageWebpCtx.patch deleted file mode 100644 index fdf522c..0000000 --- a/gd-2.2.3-overflow-in-gdImageWebpCtx.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 2806adfdc27a94d333199345394d7c302952b95f Mon Sep 17 00:00:00 2001 -From: trylab -Date: Tue, 6 Sep 2016 18:35:32 +0800 -Subject: [PATCH] Fix integer overflow in gdImageWebpCtx - -Integer overflow can be happened in expression gdImageSX(im) * 4 * -gdImageSY(im). It could lead to heap buffer overflow in the following -code. This issue has been reported to the PHP Bug Tracking System. The -proof-of-concept file will be supplied some days later. This issue was -discovered by Ke Liu of Tencent's Xuanwu LAB. ---- - src/gd_webp.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/src/gd_webp.c b/src/gd_webp.c -index 8eb4dee..9886399 100644 ---- a/src/gd_webp.c -+++ b/src/gd_webp.c -@@ -199,6 +199,14 @@ BGD_DECLARE(void) gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quality) - quantization = 80; - } - -+ if (overflow2(gdImageSX(im), 4)) { -+ return; -+ } -+ -+ if (overflow2(gdImageSX(im) * 4, gdImageSY(im))) { -+ return; -+ } -+ - argb = (uint8_t *)gdMalloc(gdImageSX(im) * 4 * gdImageSY(im)); - if (!argb) { - return; diff --git a/gd-2.2.4-upstream.patch b/gd-2.2.4-upstream.patch new file mode 100644 index 0000000..8aee1a0 --- /dev/null +++ b/gd-2.2.4-upstream.patch @@ -0,0 +1,50 @@ +From c9b601a658a79e6ea2aad29fbf60ca6e24ccef1e Mon Sep 17 00:00:00 2001 +From: "Christoph M. Becker" +Date: Wed, 18 Jan 2017 13:59:02 +0100 +Subject: [PATCH] Fix build issue regarding INT_MAX + +For portability gd_gd2.c needs to include . +--- + src/gd_gd2.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/gd_gd2.c b/src/gd_gd2.c +index c2904ca..049c4c5 100644 +--- a/src/gd_gd2.c ++++ b/src/gd_gd2.c +@@ -74,6 +74,7 @@ + + /* 2.0.29: no more errno.h, makes windows happy */ + #include ++#include + #include + #include "gd.h" + #include "gd_errors.h" + + +From 55ac28a293eaa8c531870c8bb8ecc04b333975f4 Mon Sep 17 00:00:00 2001 +From: "Christoph M. Becker" +Date: Thu, 19 Jan 2017 01:02:58 +0100 +Subject: [PATCH] Fix #357: 2.2.4: Segfault in test suite. + +We make sure to never pass a negative `int` as argument to a `size_t` +parameter. +--- + src/gd_io_dp.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/gd_io_dp.c b/src/gd_io_dp.c +index eda2eeb..cb38794 100644 +--- a/src/gd_io_dp.c ++++ b/src/gd_io_dp.c +@@ -292,6 +292,10 @@ static int dynamicGetbuf(gdIOCtxPtr ctx, void *buf, int len) + rlen = dp->realSize - dp->pos; + } + ++ if (rlen < 0) { ++ return 0; ++ } ++ + memcpy(buf, (void *) ((char *)dp->data + dp->pos), rlen); + dp->pos += rlen; + diff --git a/gd-2.2.x-fix-invalid-read-in-gdImageCreateFromTiffPtr.patch b/gd-2.2.x-fix-invalid-read-in-gdImageCreateFromTiffPtr.patch deleted file mode 100644 index 78a80b447e3bcfd49d5712391ee870b6803198dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10937 zcmeHN-E-T<5r^|NA)53n>BlsE*s3!LD3TxuN}?#ms$^MmG*xVkB{!XEIxGkrNW>t( z0YFPi?3p~}sn4BB`_}$D?Q8qo{~&LDYx>*6fubnM5^ar}htL*rxZB;^+x^|{-VL{t zc(6iqoBbq6vv}C24^6ry+=n8WqxaoGS2ma0>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=Xw?i?q=ZjOmh^!42kX8^T0o?Bw1Fy#rI z+D(NpEau78lR$CZ_w-Cq+;v?g9S93oO|97bZnA}2IuO4!+%*FN};rhWbG=adEh z`!)YN`?;w9Eam^F=c@W$mF`8Y;#u{1R=(?6*LBT*U2?8#UEfqWFUn5WJ>(aoyItn`=7e_i93>2=xob?NcEa;Ej1et%y1FN(j=yLi5+d9Q1pX}zc4 zuWO!f|oYQKcGUYQtp^Ttcs zhv@th7=Cc$6)E)fCtv*K#}hO^Qf(Go^v|RH6Ggv{lKy8mUX{FSkn@geZ=?P52|30@ zyNos~1NF5v&~y6>(EkeU*UZcZ$9NW}S z4X$!*Yd06%rdXW)*rw(<_t^Gb*#2{k_Lg5i0Uraa03Z8|!6*CBF2MIH+6DMtM*Cdw z{Q+EK@PX)uQqW(eumXH6xB#C)^=6Ra-)>|07DgZzJ%9t5|%a+$%Y%jK&4cBQ4z|d{m0?>0B{*vR{EvM@= zT8)<33;Y~_Ghk2sSmzS#sh_J{1$(w7yyaG7cI>G+zA4y~NYXCFo~Hc=fp1j;^#x+D R*?b1= 26 # TODO - tests using freetype 2.7 are failing @@ -139,6 +134,18 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/libgd.a %check +%ifarch %{ix86} +# See https://github.com/libgd/libgd/issues/359 +XFAIL_TESTS="gdimagegrayscale/basic $XFAIL_TESTS" +%endif +%if 0%{?fedora} >= 26 +# See https://github.com/libgd/libgd/issues/363 +XFAIL_TESTS="freetype/bug00132 $XFAIL_TESTS" +XFAIL_TESTS="gdimagestringft/gdimagestringft_bbox $XFAIL_TESTS" +%endif + +export XFAIL_TESTS + : Upstream test suite make check @@ -161,7 +168,6 @@ grep %{version} $RPM_BUILD_ROOT%{_libdir}/pkgconfig/gdlib.pc %exclude %{_bindir}/gdlib-config %files devel -%doc ChangeLog %{_bindir}/gdlib-config %{_includedir}/* %{_libdir}/*.so @@ -169,6 +175,9 @@ grep %{version} $RPM_BUILD_ROOT%{_libdir}/pkgconfig/gdlib.pc %changelog +* Wed Jan 18 2017 Remi Collet - 2.2.4-1 +- Update to 2.2.4 + * Tue Dec 06 2016 Marek Skalický - 2.2.3-5 - Fix invalid read in gdImageCreateFromTiffPtr() ( CVE-2016-6911) - Disable tests using freetype in Fedora 26 (freetype > 2.6) diff --git a/sources b/sources index 2fb8acb..976a31c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -14e4134c129b4c166c3a0549a32ef340 libgd-2.2.3.tar.xz +SHA512 (libgd-2.2.4.tar.xz) = 07903f322c4f6ab392508b0f60c38ca133699111ea92995dc6cd9379210d598bcb24a46c19657884d9e252f8663d0ee8c89c600e3a382a5ae598198c190f39b5