|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41765 Recode crashes/does not work on amd64
Submitted: 2007-06-21 14:26 UTC Modified: 2007-06-22 00:07 UTC
From: nexus at smoula dot net Assigned:
Status: Closed Package: Recode related
PHP Version: 5CVS-2007-06-21 (CVS) OS: Gentoo Linux
Private report: No CVE-ID:
 [2007-06-21 14:26 UTC] nexus at smoula dot net
When using recode extension on amd64 system I've got two states

 - Crash (SIGSEGV)
 - zero-length string output

from recode_string function.

This problem is relevant only on 64bit systems. Here is a little patch which helps.

diff -ruN php5/ext/recode/recode.c php5-b/ext/recode/recode.c
--- php5/ext/recode/recode.c    2007-01-01 10:36:05.000000000 +0100
+++ php5-b/ext/recode/recode.c  2007-06-21 16:16:31.000000000 +0200
@@ -132,7 +132,7 @@
        RECODE_REQUEST request = NULL;
        char *r = NULL;
-       int r_len = 0, r_alen = 0;
+       size_t r_len = 0, r_alen = 0;
        int req_len, str_len;
        char *req, *str;

I'm not a C programmer, so please review this patch and consequences It's going to have

Reproduce code:
  echo recode_string("utf-8..flat","aaaa");

Expected result:
should return aaaa

Actual result:
instead returns zero length string or crashes with sigsegv


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-22 00:07 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Fri Nov 27 17:01:31 2015 UTC