Skip to content
New issue

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? Sign in to your account

CVE-2015-8874: Stack consumption vulnerability in GD allows remote attackers to cause a denial of service via a crafted imagefilltoborder call #213

Closed
oerdnj opened this issue May 20, 2016 · 7 comments

Comments

@oerdnj
Copy link
Contributor

oerdnj commented May 20, 2016

Seems like we missed this fix from PHP:

From: =?utf-8?q?Ond=C5=99ej_Sur=C3=BD?= <ondrej@sury.org>
Date: Fri, 20 May 2016 09:39:38 +0200
Subject: CVE-2015-8874

---
 src/gd.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/gd.c b/src/gd.c
index 300dfce..0603247 100644
--- a/src/gd.c
+++ b/src/gd.c
@@ -1938,6 +1938,17 @@ BGD_DECLARE(void) gdImageFillToBorder (gdImagePtr im, int x, int y, int border,
    restoreAlphaBleding = im->alphaBlendingFlag;
    im->alphaBlendingFlag = 0;

+   if (x >= im->sx) {
+       x = im->sx - 1;
+   } else if (x < 0) {
+       x = 0;
+   }
+   if (y >= im->sy) {
+       y = im->sy - 1;
+   } else if (y < 0) {
+       y = 0;
+   }
+   
    for (i = x; (i >= 0); i--) {
        if (gdImageGetPixel (im, i, y) == border) {
            break;
@oerdnj
Copy link
Contributor Author

oerdnj commented May 20, 2016

Applied in 3824101, but shame we couldn't fit this to 2.2.0 release.

@oerdnj oerdnj closed this as completed May 20, 2016
@vapier
Copy link
Member

vapier commented May 20, 2016

i don't think it was posted here, so not sure how we were to see it ;)

https://bugs.php.net/bug.php?id=66387

@vapier
Copy link
Member

vapier commented May 20, 2016

ah, nm, looks like it was filed as issue #178 but the security aspect wasn't marked in there

@oerdnj
Copy link
Contributor Author

oerdnj commented May 20, 2016

Shame that PHP still keeps their own version of GD... (@pierrejoye ;))

@pierrejoye
Copy link
Contributor

Not going to change but full sync :)

@cmb69
Copy link
Contributor

cmb69 commented Jun 7, 2016

@pierrejoye @vapier At least we should try our best to cooperate as closely as possible, i.e. reporting issues back and forth between the projects. 😄 For instance, I just noticed by change that this bug has been assigned a CVE (already mailed security at php).

@pierrejoye
Copy link
Contributor

pierrejoye commented Jun 7, 2016

Thanks :)

However I am not totally sure it needs a CVE. But better more than none.

I also marked it on php as non security bug. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants