Skip to content

Commit 6e4197a

Browse files
committed
Merge branch 'PHP-7.2'
* PHP-7.2: Update NEWS Update NEWS Fixed bug #75075 (unpack with X* causes infinity loop)
2 parents b8f20d7 + 6b77792 commit 6e4197a

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

ext/standard/pack.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,10 @@ PHP_FUNCTION(unpack)
788788
/* Never use any input */
789789
case 'X':
790790
size = -1;
791+
if (arg < 0) {
792+
php_error_docref(NULL, E_WARNING, "Type %c: '*' ignored", type);
793+
arg = 1;
794+
}
791795
break;
792796

793797
case '@':
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Bug #75075 (unpack with X* causes infinity loop)
3+
--FILE--
4+
<?php
5+
var_dump(unpack("X*", ""));
6+
?>
7+
--EXPECTF--
8+
Warning: unpack(): Type X: '*' ignored in %sbug75075.php on line %d
9+
array(0) {
10+
}

0 commit comments

Comments
 (0)