Recode crashes/does not work on amd64
| 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 | ||
[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 commits
[2007-06-22 00:07 UTC] stas@php.net