Date: Tue, 23 Jun 2020 15:15:12 +0300 (MSK) From: Stanislav Grinkin <stas@sanskrit.ru> To: freebsd-i18n@freebsd.org Subject: _citrus_iconv_convert and php bug Message-ID: <alpine.BSF.2.21.2006231501140.90756@mx.grinkin.ru>
next in thread | raw e-mail | index | archive | help
Hi all, I'm not familiar in C but may be somebody has idea about this bug in php or/and iconv implementation in freebsd libc. Shortly: php -r 'echo iconv("UTF-8", "UTF-8", "Hello, world.\n");' Bus error (core dumped) bug desribed in a few places: https://bugs.php.net/bug.php?id=74014 https://bugs.php.net/bug.php?id=72198 it seems bug does exist even in php 7.x. I caught it in very old version php 5.6.40 - some old site on old joomla framework. Well, we have php.core and what we see: uname -a FreeBSD space 12.1-RELEASE-p4 FreeBSD 12.1-RELEASE-p4 GENERIC amd64 gdb sapi/cli/php php.core GNU gdb (GDB) 9.2 [GDB v9.2 for FreeBSD] <skip> Reading symbols from sapi/cli/php... [New LWP 100454] Core was generated by `sapi/cli/php -r echo iconv("UTF-8", "UTF-8", "Hello, world.\n");'. Program terminated with signal SIGBUS, Bus error. #0 0x0000000801296711 in _citrus_iconv_convert (cv=0x80253a000, in=0x7fffffffe190, inbytes=0x7fffffffe1a0, out=0x7fffffffe1b8, outbytes=0x7fffffffe1c0, flags=0, nresults=0x0) at /usr/src/lib/libc/iconv/citrus_iconv.h:62 62 /usr/src/lib/libc/iconv/citrus_iconv.h: No such file or directory. warning: File "/usr/local/src/php-5.6.40/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load". To enable execution of this file add --Type <RET> for more, q to quit, c to continue without paging-- add-auto-load-safe-path /usr/local/src/php-5.6.40/.gdbinit line to your configuration file "/root/.gdbinit". To completely disable this security protection add set auto-load safe-path / line to your configuration file "/root/.gdbinit". For more information about this security protection see the "Auto-loading safe path" section in the GDB manual. E.g., run from the shell: info "(gdb)Auto-loading safe path" (gdb) bt #0 0x0000000801296711 in _citrus_iconv_convert (cv=0x80253a000, in=0x7fffffffe190, inbytes=0x7fffffffe1a0, out=0x7fffffffe1b8, outbytes=0x7fffffffe1c0, flags=0, nresults=0x0) at /usr/src/lib/libc/iconv/citrus_iconv.h:62 #1 __bsd_iconv (handle=0x80253a000, in=0x7fffffffe190, szin=0x7fffffffe1a0, out=0x7fffffffe1b8, szout=0x7fffffffe1c0) at /usr/src/lib/libc/iconv/bsd_iconv.c:135 #2 0x000000000099cf7b in php_iconv_string (in_p=0x801cddca0 "Hello, world.\n", in_len=14, out=0x7fffffffe208, out_len=0x7fffffffe210, out_charset=<optimized out>, in_charset=<optimized out>) at ext/iconv/iconv.c:653 #3 0x000000000099a5dd in php_if_iconv (ht=<optimized out>, return_value=0x801c9fa10, return_value_ptr=<optimized out>, this_ptr=<optimized out>, return_value_used=<optimized out>) at ext/iconv/iconv.c:2490 #4 0x0000000000bded49 in zend_do_fcall_common_helper_SPEC (execute_data=0x801c6bd20) at Zend/zend_vm_execute.h:558 #5 0x0000000000b9e2e8 in execute_ex (execute_data=0x801c6bd20) at Zend/zend_vm_execute.h:363 #6 0x0000000000b65e21 in zend_eval_stringl (str=<optimized out>, str_len=<optimized out>, retval_ptr=<optimized out>, string_name=<optimized out>) at Zend/zend_execute_API.c:1080 #7 0x0000000000b6621c in zend_eval_stringl_ex ( str=0x7fffffffedb0 "echo iconv(\"UTF-8\", \"UTF-8\", \"Hello, world.\\n\");", str_len=-443987883, retval_ptr=0x7fffffffe1a0, string_name=0x7fffffffe1b8 "@\372\311\001\b", handle_exceptions=1) at Zend/zend_execute_API.c:1127 #8 zend_eval_string_ex ( str=0x7fffffffedb0 "echo iconv(\"UTF-8\", \"UTF-8\", \"Hello, world.\\n\");", retval_ptr=0x7fffffffe1a0, string_name=0x7fffffffe1b8 "@\372\311\001\b", handle_exceptions=1) a piece of code at ext/iconv/iconv.c:653: result = iconv(cd, (char **) &in_p, &in_left, (char **) &out_p, &out_left); That version of php, compiled under linux (Linux test 4.4.217 #1 SMP Thu Mar 26 14:44:04 CDT 2020 x86_64 Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz GenuineIntel GNU/Linux) works correctly. Has anybody ideas how to fix it? -- Best regards, Stanislav
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.21.2006231501140.90756>