diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2018-09-22 15:20:20 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2018-09-22 15:20:20 +0200 |
commit | 9cbe1283f70699b82ca4225705d40fcc73633dfb (patch) | |
tree | bd699e05e8a47b7956d0adc9508b1a2f187ff458 /ext/soap/php_xml.c | |
parent | 842bec5b3c539396d6ff9e207ba55f626b42524e (diff) | |
download | php-git-9cbe1283f70699b82ca4225705d40fcc73633dfb.tar.gz |
Fix #66828: iconv_mime_encode Q-encoding longer than it should be
Before the fix for bug 48289 has been applied, the algorithm to
construct a Q-encoded-word has been optimistic, i.e. try to encode as
many bytes that *may* fit in the remaining space, calculate the actual
length of the Q-encoded word, and if it's too long, try again with a
reduced size. However, the fix for the mentioned bug replaced this by
a pessimistic algorithm, which always terminates[1] the for loop[2]
during the first iteration (which renders the following 3 lines as dead
code), and as such easily produces unnecessarily short encoded-words.
Instead the proper fix for the bug would have been to make sure that
`out_size` is always decremented, if the space isn't sufficient for the
encoded-word.
[1] <https://github.com/php/php-src/blob/php-7.3.0beta3/ext/iconv/iconv.c#L1421>
[2] <https://github.com/php/php-src/blob/php-7.3.0beta3/ext/iconv/iconv.c#L1360>
Diffstat (limited to 'ext/soap/php_xml.c')
0 files changed, 0 insertions, 0 deletions