php.net |  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: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nexus at smoula dot net
New email:
PHP Version: OS:

 

 [2007-06-21 14:26 UTC] nexus at smoula dot net
Description:
------------
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:
---------------
<?php
  echo recode_string("utf-8..flat","aaaa");
?>

Expected result:
----------------
should return aaaa

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-22 00:07 UTC] stas@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jan 02 13:01:30 2025 UTC