--- /dev/null
-Warning: imagecreate():%S product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+ --TEST--
+ Bug #77269 (Potential unsigned underflow in gdImageScale)
+ --SKIPIF--
+ <?php
+ if (!extension_loaded('gd')) die('skip gd extension not available');
+ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+ ?>
+ --INI--
+ memory_limit=2G
+ --FILE--
+ <?php
+ $im = imagecreate(2**28, 1);
+ if(is_resource($im)) {
+ imagescale($im, 1, 1, IMG_TRIANGLE);
+ }
+ ?>
+ ===DONE===
+ --EXPECTF--
++Warning: imagescale():%S product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+ in %s on line %d
+ ===DONE===
break;
default:
- PUNFETCH;
- num = fetch_escaped_value(&p, end, env);
- if (num < 0) return num;
- /* set_raw: */
- if (tok->u.c != num) {
- tok->type = TK_CODE_POINT;
- tok->u.code = (OnigCodePoint )num;
- }
- else { /* string */
+ {
+ OnigCodePoint c2;
+
+ PUNFETCH;
+ num = fetch_escaped_value(&p, end, env, &c2);
+ if (num < 0) return num;
+ /* set_raw: */
+ if (tok->u.c != c2) {
+ tok->type = TK_CODE_POINT;
+ tok->u.code = c2;
+ }
+ else { /* string */
+ p = tok->backp + enclen(enc, tok->backp);
+ int len;
+ SAFE_ENC_LEN(enc, tok->backp, end, len);
+ p = tok->backp + len;
+ }
}
break;
}