From 3f9af558e78c9904f72933dfb3c735a9d2119b52 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 20 Aug 2013 01:07:26 -0600 Subject: Fix #65483: quoted-printable encode stream filter incorrectly encoding spaces --- ext/standard/filters.c | 4 +++- ext/standard/tests/streams/bug65483.phpt | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 ext/standard/tests/streams/bug65483.phpt (limited to 'ext/standard') diff --git a/ext/standard/filters.c b/ext/standard/filters.c index 0a59039635..15dae1bee6 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -951,7 +951,9 @@ static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *ins *(pd++) = qp_digits[(c & 0x0f)]; ocnt -= 3; line_ccnt -= 3; - trail_ws--; + if (trail_ws > 0) { + trail_ws--; + } CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt); } } diff --git a/ext/standard/tests/streams/bug65483.phpt b/ext/standard/tests/streams/bug65483.phpt new file mode 100644 index 0000000000..d214bbbbcc --- /dev/null +++ b/ext/standard/tests/streams/bug65483.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #65483: quoted-printable encode stream filter incorrectly encoding spaces +--FILE-- + +--EXPECT-- +string(9) "a b=3Dc d" -- cgit v1.2.1