mirror of
https://github.com/php/php-src.git
synced 2026-04-14 03:22:58 +02:00
Calling imagesetstyle() with an empty $styles array caused gdImageSetStyle() to be called with `noOfPixels==0`, what could have lead to OOB reads. Actually, this issue will be fixed in libgd, but to avoid issues when older libgd is in use, we simply disallow passing an empty $styles array to imagesetstyle(), what wouldn't serve a useful purpose anyway.
19 lines
447 B
PHP
19 lines
447 B
PHP
--TEST--
|
|
Bug #72709 (imagesetstyle() causes OOB read for empty $styles)
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('gd')) die('skip ext/gd not available');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$im = imagecreatetruecolor(1, 1);
|
|
var_dump(imagesetstyle($im, array()));
|
|
imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
|
|
imagedestroy($im);
|
|
?>
|
|
====DONE====
|
|
--EXPECTF--
|
|
Warning: imagesetstyle(): styles array must not be empty in %s%ebug72709.php on line %d
|
|
bool(false)
|
|
====DONE====
|