Skip to content

Commit cc46f1b

Browse files
committed
Return early
1 parent 98bf240 commit cc46f1b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ext/bz2/bz2_filter.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
361361
zend_long blocks = zval_get_long(tmpzval);
362362
if (blocks < 1 || blocks > 9) {
363363
zend_value_error("Invalid parameter given for number of blocks to allocate. (" ZEND_LONG_FMT ")", blocks);
364+
return NULL;
364365
} else {
365366
blockSize100k = (int) blocks;
366367
}
@@ -371,6 +372,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
371372
zend_long work = zval_get_long(tmpzval);
372373
if (work < 0 || work > 250) {
373374
zend_value_error("Invalid parameter given for work factor. (" ZEND_LONG_FMT ")", work);
375+
return NULL;
374376
} else {
375377
workFactor = (int) work;
376378
}

ext/bz2/tests/bug72447.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ fclose($fp);
2222
<?php
2323
unlink('testfile');
2424
?>
25-
--EXPECT--
25+
--EXPECTF--
26+
Warning: stream_filter_append(): unable to create or locate filter "bzip2.compress" %s on line %d
2627
Invalid parameter given for number of blocks to allocate. (0)

0 commit comments

Comments
 (0)