ID: 16069
Comment by: readjust@deneb.freemail.ne.jp
Reported By: readjust@deneb.freemail.ne.jp
Status: Closed
Bug Type: ICONV related
Operating System: win32, Linux
PHP Version: 4.3.0-dev
New Comment:
no need to mind if php is built with the iconv library that doesn't
properly handle cp932(especially glibc iconv).
but in such case it should have been SKIPed rather than FAILed.
posibble unit test's bug.
Previous Comments:
------------------------------------------------------------------------
[2002-08-03 20:25:54] yohgaki@php.net
IIRC, libiconv is needed to perform transit with CP932.
------------------------------------------------------------------------
[2002-08-03 09:34:29] msopacua@idg.nl
If the test is correct, this still fails on BSD/OS.
Testlog submitted to Yohgaki, to preserve charset.
------------------------------------------------------------------------
[2002-07-10 23:32:41] yohgaki@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a
documentation
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2002-07-06 19:28:46] sniper@php.net
Not fixed. (updated version too)
------------------------------------------------------------------------
[2002-07-05 16:39:54] readjust@deneb.freemail.ne.jp
I have just tried again with the HEAD.
--------------------------------
$ ./buildconf
$ ./configure --with-iconv=/usr/lib \
--prefix=/home/koizumi/local
$ make
$ make install
$ /home/koizumi/local/bin/php -q test.php
(13 lines printed)
Segmentation fault
--------------------------------
Backtrace:
#0 0x401f2e8f in chunk_free (ar_ptr=0x402a6620, p=0x1c775d9f) at
malloc.c:3225
#1 0x401f2bf4 in __libc_free (mem=0x81d1a48) at malloc.c:3154
#2 0x40035602 in libiconv_close () from /usr/lib/libiconv.so.2
#3 0x08062fe9 in php_iconv_string (in_p=0x81d17cc "", in_len=32,
out=0xbfffd060, out_len=0xbfffd064, in_charset=0x81d66b4 "CP932",
out_charset=0x81d0db4 "EUC-JP//TRANSLIT", err=0xbfffd068)
at /home/koizumi/src/php4/ext/iconv/iconv.c:194
#4 0x0806308f in php_if_iconv (ht=3, return_value=0x81d0d24,
this_ptr=0x0,
return_value_used=1) at
/home/koizumi/src/php4/ext/iconv/iconv.c:292
(gdb) select-frame 3
(gdb) print out_size
$1 = 144
(gdb) print out_left
$2 = 0
--------------------------------
Now I realized that what is to blame for segv.
------------------------------------------
*out_len = out_size - out_left;
out_buffer[*out_len] = '\0';
icv_close(cd);
------------------------------------------
Here's the patch.
(I'll resend this one if you think it better)
===================================================================
RCS file: /repository/php4/ext/iconv/iconv.c,v
retrieving revision 1.39
diff -u -r1.39 iconv.c
--- iconv.c 28 Jun 2002 07:12:32 -0000 1.39
+++ iconv.c 5 Jul 2002 20:35:50 -0000
@@ -164,7 +164,7 @@
I added 15 extra bytes for safety. <yohgaki@php.net>
*/
out_size = in_len * sizeof(ucs4_t) + 16;
- out_buffer = (char *) emalloc(out_size);
+ out_buffer = (char *) emalloc(out_size+1);
*out = out_buffer;
out_p = out_buffer;
==============================================
THIS PATCH DOESN'T REALLY FIX THE BUG #16069.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/16069
--
Edit this bug report at http://bugs.php.net/?id=16069&edit=1