|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-12-03 10:00 UTC] wupco1996 at gmail dot com
Description: ------------ Here is my analysis report. https://hackmd.io/s/rJlfZva0m Test script: --------------- <?php file(urldecode('php://filter/convert.quoted-printable-encode/resource=data://,%bfAAAAAAAAFAAAAAAAAAAAAAA%ff%ff%ff%ff%ff%ff%ff%ffAAAAAAAAAAAAAAAAAAAAAAAA')); ?> Expected result: ---------------- \xbfAAAAAAAAFAAAAAAAAAAAAAA\xff\xff\xff\xff\xff\xff\xff\xffAAAAAAAAAAAAAAAAAAAAAAAA Actual result: -------------- segment fault PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
The problem seems to happen because of this: if (line_ccnt < 4) { if (ocnt < inst->lbchars_len + 1) { err = PHP_CONV_ERR_TOO_BIG; break; } *(pd++) = '='; ocnt--; line_ccnt--; memcpy(pd, inst->lbchars, inst->lbchars_len); check for inst->lbchars being null is missing, thus causing memcpy to access null pointer. This should fix it: diff --git a/ext/standard/filters.c b/ext/standard/filters.c index dc7b0d86dc..9718a45be2 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -928,7 +928,7 @@ static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *ins line_ccnt--; CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt); } else { - if (line_ccnt < 4) { + if (line_ccnt < 4 && inst->lbchars != NULL) { if (ocnt < inst->lbchars_len + 1) { err = PHP_CONV_ERR_TOO_BIG; break; Could you please verify it?The patch ``` - if (line_ccnt < 4) { + if (line_ccnt < 4 && inst->lbchars != NULL) { ``` is all right i think.