From:             nexus at smoula dot net
Operating system: Gentoo Linux
PHP version:      5CVS-2007-06-21 (CVS)
PHP Bug Type:     Unknown/Other Function
Bug description:  Recode crashes/does not work on amd64

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

-- 
Edit bug report at http://bugs.php.net/?id=41765&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41765&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41765&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41765&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41765&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41765&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41765&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41765&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41765&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41765&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41765&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41765&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41765&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41765&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41765&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41765&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41765&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41765&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41765&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41765&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41765&r=mysqlcfg

Reply via email to