Permalink
Show file tree
Hide file tree
1 comment
on commit
sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix DOS vulnerability in gdImageCreateFromGd2Ctx()
We must not pretend that there are image data if there are none. Instead we fail reading the image file gracefully.
- Loading branch information
Showing
6 changed files
with
35 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,4 @@ | |
| /gd2_read | ||
| /gd2_read_corrupt | ||
| /php_bug_72339 | ||
| /too_few_image_data | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ LIST(APPEND TESTS_FILES | |
| php_bug_72339 | ||
| gd2_read | ||
| gd2_read_corrupt | ||
| too_few_image_data | ||
| ) | ||
|
|
||
| ADD_GD_TESTS() | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /* | ||
| too_few_image_data.gd2 claims to have a size of 12336x48 pixels, but doesn't | ||
| provide as much image data. We test that gdImageCreateFromGd2Ctx() returns NULL | ||
| in this case. | ||
| */ | ||
|
|
||
| #include "gd.h" | ||
| #include "gdtest.h" | ||
|
|
||
| int main() | ||
| { | ||
| gdImagePtr im; | ||
| FILE *fp; | ||
|
|
||
| fp = gdTestFileOpen2("gd2", "too_few_image_data.gd2"); | ||
| gdTestAssert(fp != NULL); | ||
| im = gdImageCreateFromGd2(fp); | ||
| gdTestAssert(im == NULL); | ||
| fclose(fp); | ||
|
|
||
| return gdNumFailures(); | ||
| } |
Binary file not shown.
fe9ed49There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is CVE-2016-10167