forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-5.6: prevent invalid color index (palette only), may lead to crash Add CVE to #66387 add missing NEWS entry
- Loading branch information
Showing
3 changed files
with
54 additions
and
1 deletion.
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
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,43 @@ | ||
--TEST-- | ||
Github #215 (imagefilltoborder stack overflow when invalid pallete index used) | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded("gd")) die("skip GD not present"); | ||
?> | ||
--FILE-- | ||
<?php | ||
$image = imagecreate( 10, 10 ); | ||
$bgd = imagecolorallocate( $image, 0, 0, 0 ); | ||
$border = imagecolorallocate( $image, 255, 0, 0 ); | ||
$fillcolor = imagecolorallocate( $image, 255, 0, 0 ); | ||
|
||
/* Use unallocated color index */ | ||
imagefilltoborder( $image, 0,0, $border+10, $fillcolor); | ||
echo "#1 passes\n"; | ||
|
||
/* Use negative color index */ | ||
imagefilltoborder( $image, 0,0, -$border, $fillcolor); | ||
echo "#2 passes\n"; | ||
|
||
|
||
/* Use unallocated color index */ | ||
imagefilltoborder( $image, 0,0, $border, $fillcolor+10); | ||
echo "#3 passes\n"; | ||
|
||
/* Use negative color index */ | ||
imagefilltoborder( $image, 0,0, $border, -$fillcolor); | ||
echo "#4 passes\n"; | ||
|
||
|
||
/* Use negative color index */ | ||
imagefilltoborder( $image, 0,0, $border+10, $fillcolor+10); | ||
echo "#5 passes"; | ||
|
||
|
||
?> | ||
--EXPECT-- | ||
#1 passes | ||
#2 passes | ||
#3 passes | ||
#4 passes | ||
#5 passes |