|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-12-16 17:44 UTC] web-php-bugs at sklar dot com
Description:
------------
When transliterate() is called with a 0-length string, the compact_underscores_convert filter segfaults on line 36 because out_idx is 0, so
tmp_out[out_idx - 1]
is out of bounds.
(This could be an issue with other filters, too.)
Reproduce code:
---------------
$s = transliterate('', array('compact_underscores'), 'utf-8','ascii');
Expected result:
----------------
$s is set to ''
Actual result:
--------------
Segmentation fault
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 11:00:01 2025 UTC |
Patch that fixes the problem: *** data/compact_underscores.c.orig 2010-03-09 15:12:25.000000000 -0500 --- data/compact_underscores.c 2010-03-09 16:16:03.000000000 -0500 *************** *** 33,39 **** count = 0; } } ! while (tmp_out[out_idx - 1] == (unsigned short) '_') { out_idx--; } *out_length = out_idx; --- 33,39 ---- count = 0; } } ! while ((out_idx > 0) && (tmp_out[out_idx - 1] == (unsigned short) '_')) { out_idx--; } *out_length = out_idx;