xref: /php-src/ext/gd/tests/gh16322.phpt (revision f2859a40)
1--TEST--
2GH-16322 (imageaffine overflow/underflow on affine matrix)
3--EXTENSIONS--
4gd
5--INI--
6memory_limit=-1
7--FILE--
8<?php
9$matrix = [INF, 1, 1, 1, 1, 1];
10$src = imagecreatetruecolor(8, 8);
11
12try {
13	imageaffine($src, $matrix);
14} catch (\ValueError $e) {
15	echo $e->getMessage() . PHP_EOL;
16}
17$matrix[0] = 1;
18$matrix[3] = -INF;
19try {
20	imageaffine($src, $matrix);
21} catch (\ValueError $e) {
22	echo $e->getMessage();
23}
24?>
25--EXPECTF--
26imageaffine(): Argument #2 ($affine) element 0 must be between %s and %d
27imageaffine(): Argument #2 ($affine) element 3 must be between %s and %d
28