#47663 [Opn]: dcngettext() crashes if count parameter is negative
| From: | jani@php.net | Date: | Tue, 14 Apr 2009 09:20:59 +0000 |
| Subject: | #47663 [Opn]: dcngettext() crashes if count parameter is negative | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-135797@lists.php.net to get a copy of this message | ||
ID: 47663
Updated by: jani@php.net
Reported By: dsp@php.net
Status: Open
Bug Type: Gettext related
Operating System: OpenSolaris 2009.11
PHP Version: 5.2.9
New Comment:
Note: Linux glibc gettext implementation does not crash..
Previous Comments:
------------------------------------------------------------------------
[2009-04-14 09:15:19] jani@php.net
Also, the possible fix to prevent this in PHP should consider all the
plural gettext functions:
ngettext(), dngettext() and dcngettext()
------------------------------------------------------------------------
[2009-04-14 09:13:27] jani@php.net
"In the "C" locale, or if none of the used catalogs contain a
translation for msgid, the ngettext, dngettext and dcngettext functions
return msgid if n == 1, or msgid_plural if n != 1."
That crash should be reported to Sun too so they can fix their gettext
implementation. :)
------------------------------------------------------------------------
[2009-03-15 15:07:08] dsp@php.net
Description:
------------
Passing -1 to the count argument of dcngettext leads to a PHP core dump
on OpenSolaris.
Reproduce code:
---------------
make test TESTS=ext/gettext/tests
will crash when testing dcngettext.phpt
Expected result:
----------------
no crash
Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
0xfedaaa76 in _real_gettext_u () from /lib/libc.so.1
(gdb) bt
#0 0xfedaaa76 in _real_gettext_u () from /lib/libc.so.1
#1 0xfeda8d7a in dcngettext () from /lib/libc.so.1
#2 0x080f8692 in zif_dcngettext (ht=5, return_value=0x83d4b0c,
return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)
at /export/home/dsp/dev/c/php52/ext/gettext/gettext.c:356
#3 0x08275389 in zend_do_fcall_common_helper_SPEC
(execute_data=0x8047320) at zend_vm_execute.h:200
#4 0x08274b39 in execute (op_array=0x83d5090) at zend_vm_execute.h:92
#5 0x0825b469 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /export/home/dsp/dev/c/php52/Zend/zend.c:1134
#6 0x08223079 in php_execute_script (primary_file=0x8047a94) at
/export/home/dsp/dev/c/php52/main/main.c:2023
#7 0x082d7a09 in main (argc=2, argv=0x8047b18) at
/export/home/dsp/dev/c/php52/sapi/cli/php_cli.c:1133
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47663&edit=1