xref: /PHP-8.3/ext/gd/tests/bug72697.phpt (revision a375d547)
1--TEST--
2Bug #72697: select_colors write out-of-bounds
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7if (PHP_INT_MAX !== 9223372036854775807) die("skip for 64-bit long systems only");
8?>
9--FILE--
10<?php
11
12require __DIR__ . '/func.inc';
13
14$img=imagecreatetruecolor(10, 10);
15
16trycatch_dump(
17    fn() => imagetruecolortopalette($img, false, PHP_INT_MAX / 8)
18);
19
20?>
21DONE
22--EXPECT--
23!! [ValueError] imagetruecolortopalette(): Argument #3 ($num_colors) must be greater than 0 and less than 2147483647
24DONE
25