xref: /php-src/ext/gd/tests/bug72337.phpt (revision 23a55bab)
1--TEST--
2 #72337	segfault in imagescale with new dimensions being <=0)
3--EXTENSIONS--
4gd
5--FILE--
6<?php
7$im = imagecreatetruecolor(1, 1);
8try {
9	imagescale($im, 1, 1, -10);
10} catch (\ValueError $e) {
11	echo $e->getMessage() . PHP_EOL;
12}
13try {
14	imagescale($im, 0, 1, 0);
15} catch (\ValueError $e) {
16	echo $e->getMessage() . PHP_EOL;
17}
18try {
19	imagescale($im, 1, 0, 0);
20} catch (\ValueError $e) {
21	echo $e->getMessage() . PHP_EOL;
22}
23imagescale($im, 1, 1, IMG_BICUBIC_FIXED);
24echo "OK";
25?>
26--EXPECT--
27imagescale(): Argument #4 ($mode) must be one of the GD_* constants
28imagescale(): Argument #2 ($width) must be between 1 and 2147483647
29imagescale(): Argument #3 ($height) must be between 1 and 2147483647
30OK
31