1--TEST-- 2Bug #38212 (Seg Fault on invalid imagecreatefromgd2part() parameters) 3--EXTENSIONS-- 4gd 5--SKIPIF-- 6<?php 7 if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) { 8 die("skip test requires GD 2.3.2 or older"); 9 } 10?> 11--FILE-- 12<?php 13require __DIR__ . '/func.inc'; 14 15$file = __DIR__ . '/bug38212.gd2'; 16$im1 = imagecreatetruecolor(10,100); 17imagefill($im1, 0,0, 0xffffff); 18imagegd2($im1, $file); 19 20trycatch_dump( 21 fn() => imagecreatefromgd2part($file, 0,0, -25, 10), 22 fn() => imagecreatefromgd2part($file, 0,0, 10, -25) 23); 24 25unlink($file); 26?> 27--EXPECT-- 28!! [ValueError] imagecreatefromgd2part(): Argument #4 ($width) must be greater than or equal to 1 29!! [ValueError] imagecreatefromgd2part(): Argument #5 ($height) must be greater than or equal to 1 30