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