Skip to content

Commit d5dc3c6

Browse files
committed
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Fix null pointer deref in qprint-encode filter (bug #77231)
2 parents 8ab5d22 + 036bc5c commit d5dc3c6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

ext/standard/filters.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *ins
922922
line_ccnt--;
923923
CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt);
924924
} else {
925-
if (line_ccnt < 4) {
925+
if (line_ccnt < 4 && inst->lbchars != NULL) {
926926
if (ocnt < inst->lbchars_len + 1) {
927927
err = PHP_CONV_ERR_TOO_BIG;
928928
break;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Bug #77231 (Segfault when using convert.quoted-printable-encode filter)
3+
--FILE--
4+
<?php
5+
var_dump(file(urldecode('php://filter/convert.quoted-printable-encode/resource=data://,%bfAAAAAAAAFAAAAAAAAAAAAAA%ff%ff%ff%ff%ff%ff%ff%ffAAAAAAAAAAAAAAAAAAAAAAAA')));
6+
?>
7+
--EXPECT--
8+
array(1) {
9+
[0]=>
10+
string(74) "=BFAAAAAAAAFAAAAAAAAAAAAAA=FF=FF=FF=FF=FF=FF=FF=FFAAAAAAAAAAAAAAAAAAAAAAAA"
11+
}

0 commit comments

Comments
 (0)