com php-src: Fix #65483: quoted-printable encode stream filter incorrectly encoding spaces: NEWS ext/standard/filters.c
ext/standard/tests/streams/bug65483.phpt
| From: | Stanislav Malyshev | Date: | Sun, 25 Aug 2013 02:45:54 +0000 |
| Subject: | com php-src: Fix #65483: quoted-printable encode stream filter incorrectly encoding spaces: NEWS ext/standard/filters.c ext/standard/tests/streams/bug65483.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73090@lists.php.net to get a copy of this message | ||
Commit: 3f9af558e78c9904f72933dfb3c735a9d2119b52
Author: Michael M Slusarz <slusarz@curecanti.org> Tue, 20 Aug 2013 01:07:26 -0600
Committer: Stanislav Malyshev <stas@php.net> Sat, 24 Aug 2013 19:45:54 -0700
Parents: 768c34e7cd4a7d9f7290825e887cb90fa0b137cc
Branches: PHP-5.4 PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3f9af558e78c9904f72933dfb3c735a9d2119b52
Log:
Fix #65483: quoted-printable encode stream filter incorrectly encoding spaces
Bugs:
https://bugs.php.net/65483
Changed paths:
M NEWS
M ext/standard/filters.c
A ext/standard/tests/streams/bug65483.phpt
Diff:
diff --git a/NEWS b/NEWS
index d73cf3e..ef046fd 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PHP NEWS
- Core:
. Fixed bug #65490 (Duplicate calls to get lineno & filename for
DTRACE_FUNCTION_*). (Chris Jones)
+ . Fixed bug #65483 (quoted-printable encode stream filter incorrectly encoding
+ spaces). (Michael M Slusarz)
. Fixed bug #65481 (shutdown segfault due to serialize) (Mike)
. Fixed bug #65470 (Segmentation fault in zend_error() with
--enable-dtrace).. (Chris Jones, Kris Van Hees)
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index 0a59039..15dae1b 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 0000000..d214bbb
--- /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--
+<?php
+
+$data = 'a b=c d';
+
+$fd = fopen('php://temp', 'w+');
+fwrite($fd, $data);
+rewind($fd);
+
+$res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ);
+var_dump(stream_get_contents($fd, -1, 0));
+
+fclose($fd);
+
+?>
+--EXPECT--
+string(9) "a b=3Dc d"