Openembedded Devel Discussions
 help / color / mirror / Atom feed
From: Martin Jansa <martin.jansa@gmail.com>
To: openembedded-devel@lists.openembedded.org
Subject: Re: [PATCH] gd: Security Advisory CVE-2016-7568
Date: Fri, 21 Oct 2016 18:41:06 +0200	[thread overview]
Message-ID: <20161021164106.GA2899@jama> (raw)
In-Reply-To: <1477037954-141118-1-git-send-email-dengke.du@windriver.com>

[-- Attachment #1: Type: text/plain, Size: 5627 bytes --]

On Fri, Oct 21, 2016 at 04:19:14PM +0800, Dengke Du wrote:
> Backport patch to fix CVE-2016-7568 from gd upstream:
> 
> 	https://github.com/libgd/libgd/commit/2806adfdc27a94d333199345394d7c302952b95f
> 

Doesn't apply, always rebase on latest master before sending (gd was
last updated months ago).

OE @ ~/meta-openembedded $ pwam 133109
2016-10-21 18:39:13 URL:https://patchwork.openembedded.org/patch/133109/mbox/ [2947] -> "pw-am-133109.patch" [1]
Applying: gd: Security Advisory CVE-2016-7568
.git/rebase-apply/patch:37: space before tab in indent.
                quality = 80;
.git/rebase-apply/patch:38: space before tab in indent.
        }
.git/rebase-apply/patch:39: trailing whitespace.
 
.git/rebase-apply/patch:48: space before tab in indent.
        argb = (uint8_t *)gdMalloc(gdImageSX(im) * 4 * gdImageSY(im));
.git/rebase-apply/patch:49: space before tab in indent.
        if (!argb) {
error: patch failed: meta-oe/recipes-support/gd/gd_2.2.3.bb:15
error: meta-oe/recipes-support/gd/gd_2.2.3.bb: patch does not apply
Patch failed at 0001 gd: Security Advisory CVE-2016-7568
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
OE @ ~/meta-openembedded $ patch -p1 < pw-am-133109.patch 
patching file meta-oe/recipes-support/gd/gd/0001-Fix-integer-overflow-in-gdImageWebpCtx.patch
patching file meta-oe/recipes-support/gd/gd_2.2.3.bb
Hunk #1 FAILED at 15.
1 out of 1 hunk FAILED -- saving rejects to file meta-oe/recipes-support/gd/gd_2.2.3.bb.rej
OE @ ~/meta-openembedded $ cat meta-oe/recipes-support/gd/gd_2.2.3.bb.rej
--- meta-oe/recipes-support/gd/gd_2.2.3.bb
+++ meta-oe/recipes-support/gd/gd_2.2.3.bb
@@ -15,6 +15,7 @@ DEPENDS = "freetype libpng jpeg zlib tiff"
 SRC_URI = "git://github.com/libgd/libgd.git;branch=GD-2.2 \
            file://fix-gcc-unused-functions.patch \
            file://disable-jpeg_read-test.patch \
+           file://0001-Fix-integer-overflow-in-gdImageWebpCtx.patch \
           "
 
 SRCREV = "46ceef5970bf3a847ff61d1bdde7501d66c11d0c"
OE @ ~/meta-openembedded $ git log meta-oe/recipes-support/gd/gd_2.2.3.bb
commit 289217bbc3c5c53f486ab5615a6d6196e3c12cf2
Author: Martin Jansa <Martin.Jansa@gmail.com>
Date:   Thu Aug 18 18:53:48 2016 +0200

    meta-oe: fix indentation
    
    * remove tabs which sneaked in since last cleanup
    * meta-oe layers are using consistent indentation with 4 spaces, see
      http://www.openembedded.org/wiki/Styleguide
    
    Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>


> Signed-off-by: Dengke Du <dengke.du@windriver.com>
> ---
>  ...01-Fix-integer-overflow-in-gdImageWebpCtx.patch | 41 ++++++++++++++++++++++
>  meta-oe/recipes-support/gd/gd_2.2.3.bb             |  1 +
>  2 files changed, 42 insertions(+)
>  create mode 100644 meta-oe/recipes-support/gd/gd/0001-Fix-integer-overflow-in-gdImageWebpCtx.patch
> 
> diff --git a/meta-oe/recipes-support/gd/gd/0001-Fix-integer-overflow-in-gdImageWebpCtx.patch b/meta-oe/recipes-support/gd/gd/0001-Fix-integer-overflow-in-gdImageWebpCtx.patch
> new file mode 100644
> index 0000000..9967e23
> --- /dev/null
> +++ b/meta-oe/recipes-support/gd/gd/0001-Fix-integer-overflow-in-gdImageWebpCtx.patch
> @@ -0,0 +1,41 @@
> +From 2806adfdc27a94d333199345394d7c302952b95f Mon Sep 17 00:00:00 2001
> +From: trylab <trylab@users.noreply.github.com>
> +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.
> +
> +Upstream-Status: Backport
> +
> +CVE-2016-7568
> +
> +---
> + 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)
> + 		quality = 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;
> +-- 
> +2.9.3
> +
> diff --git a/meta-oe/recipes-support/gd/gd_2.2.3.bb b/meta-oe/recipes-support/gd/gd_2.2.3.bb
> index 9655e9c..f7d4f44 100644
> --- a/meta-oe/recipes-support/gd/gd_2.2.3.bb
> +++ b/meta-oe/recipes-support/gd/gd_2.2.3.bb
> @@ -15,6 +15,7 @@ DEPENDS = "freetype libpng jpeg zlib tiff"
>  SRC_URI = "git://github.com/libgd/libgd.git;branch=GD-2.2 \
>             file://fix-gcc-unused-functions.patch \
>             file://disable-jpeg_read-test.patch \
> +           file://0001-Fix-integer-overflow-in-gdImageWebpCtx.patch \
>            "
>  
>  SRCREV = "46ceef5970bf3a847ff61d1bdde7501d66c11d0c"
> -- 
> 2.7.4
> 
> -- 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 169 bytes --]

      reply	other threads:[~2016-10-21 16:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21  8:19 [PATCH] gd: Security Advisory CVE-2016-7568 Dengke Du
2016-10-21 16:41 ` Martin Jansa [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161021164106.GA2899@jama \
    --to=martin.jansa@gmail.com \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox