|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35575 gettext call segfaults with memory allocation error
Submitted: 2005-12-06 22:37 UTC Modified: 2005-12-07 20:00 UTC
From: tokul at users dot sourceforge dot net Assigned:
Status: Not a bug Package: Gettext related
PHP Version: 5CVS-2005-12-06 (snap) OS: OpenBSD 3.8
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
30 - 16 = ?
Subscribe to this entry?

 [2005-12-06 22:37 UTC] tokul at users dot sourceforge dot net
If gettext extension manages to locate .mo file, script breaks with memory allocation error.

php compiled with --disable-all --enable-cli --with-gettext

same error in 5.0.4 and 5.1.1.

do you need php.core file?

Reproduce code:
setlocale(LC_ALL, 'ru_RU.UTF-8');
echo _("Test");

Expected result:

Actual result:
tail of kdump
15066 php      CALL  mmap(0,0x4395ef38,0x1,0x2,0x3,0,0,0)
15066 php      RET   mmap -1 errno 12 Cannot allocate memory
15066 php      CALL  mmap(0,0x4395f000,0x3,0x1002,0xffffffff,0,0,0)
15066 php      RET   mmap -1 errno 12 Cannot allocate memory
15066 php      PSIG  SIGSEGV SIG_DFL code 1 addr=0x58e64 trapno=1
15066 php      NAMI  "php.core"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-06 22:48 UTC]
JFYI: the reproduce script works perfectly fine on Linux and outputs:
 [2005-12-07 09:34 UTC] tokul at users dot sourceforge dot net
It is specific to OpenBSD. They rewrote malloc code in v.3.8. You need ru/LC_MESSAGES/ file in order to reproduce it. I think any compiled gettext translation file can be used for

I can reproduce problem with standard gettext library distributed with OpenBSD. gettext v.0.10.40.

If php is compiled against GNU gettext 0.14.3, script works as expected without segfaults.

#0  0x00085e74 in ?? ()
#1  0xe92d2eb8 in ?? ()
#2  0x00000001 in ?? ()
#3  0x00000000 in ?? ()
#4  0x0cfbcc3e in _nl_find_domain () from /usr/local/lib/
Previous frame inner to this frame (corrupt stack?)

I'll try contacting OpenBSD devels.
 [2005-12-07 09:39 UTC]
If it happens because OpenBSD developers rewrote malloc()'s code - report that problem to them.
 [2005-12-07 20:00 UTC] tokul at users dot sourceforge dot net
OpenBSD rewrote malloc in order to make it secure.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Jan 26 15:03:33 2022 UTC