Skip to content

Commit e1b24eb

Browse files
committed
ext/bz2: Reject oversized input in bzdecompress()
1 parent ade9280 commit e1b24eb

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

ext/bz2/bz2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,8 @@ PHP_FUNCTION(bzdecompress)
519519
bzs.bzalloc = NULL;
520520
bzs.bzfree = NULL;
521521

522-
if (source_len > UINT_MAX) {
523-
zend_argument_value_error(1, "must not exceed %u bytes", UINT_MAX);
522+
if (source_len >= UINT_MAX) {
523+
zend_argument_value_error(1, "must have a length less than or equal to %u", UINT_MAX);
524524
RETURN_THROWS();
525525
}
526526

ext/bz2/tests/bzdecompress_input_too_large.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ bz2
66
memory_limit=8G
77
--SKIPIF--
88
<?php
9-
if (!getenv('RUN_RESOURCE_HEAVY_TESTS')) die('skip resource-heavy test');
10-
if (getenv('SKIP_SLOW_TESTS')) die('skip slow test');
9+
//if (!getenv('RUN_RESOURCE_HEAVY_TESTS')) die('skip resource-heavy test');
10+
//if (getenv('SKIP_SLOW_TESTS')) die('skip slow test');
1111
if (PHP_INT_SIZE != 8) echo 'skip 64-bit only';
1212
?>
1313
--FILE--
@@ -21,4 +21,4 @@ try {
2121
}
2222
?>
2323
--EXPECTF--
24-
bzdecompress(): Argument #1 ($data) must not exceed %d bytes
24+
bzdecompress(): Argument #1 ($data) must have a length less than or equal to %d

0 commit comments

Comments
 (0)