Bug 494535 - Improper idn_to_ascii() usage at php-idn causes segfault
Improper idn_to_ascii() usage at php-idn causes segfault
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: php-idn (Show other bugs)
13
All Linux
low Severity medium
: ---
: ---
Assigned To: Robert Scheck
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 517000
  Show dependency treegraph
 
Reported: 2009-04-07 07:35 EDT by Gavin Brown
Modified: 2011-06-27 10:09 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-06-27 10:09:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Gavin Brown 2009-04-07 07:35:23 EDT
Description of problem:

The following trivial PHP script causes a segmentation fault:

<?php

$str = 'موقع';

echo idn_to_ascii($str);

?>

Version-Release number of selected component (if applicable):

php-common-5.2.6-5.i386
php-cli-5.2.6-5.i386
php-idn-1.2-4.fc9.i386
libidn-0.6.14-8.i386

How reproducible:

Every time

Steps to Reproduce:
1. Run the above script, ie php test.php
  
Actual results:

$ php t.php 
Segmentation fault


Expected results:

PHP should echo the string (although the string is not a valid IDN domain name).

Additional info:

Output from gdb:

$ gdb /usr/bin/php
GNU gdb Fedora (6.8-29.fc10)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) run t.php
Starting program: /usr/bin/php t.php
warning: "/usr/lib/debug/usr/lib/libcurl.so.4.1.1.debug": The separate debug info file has no debug info
[Thread debugging using libthread_db enabled]
[New Thread 0xb7fd9730 (LWP 23506)]
warning: the debug information found in "/usr/lib/debug//usr/lib/libX11.so.6.2.0.debug" does not match "/usr/lib/libX11.so.6" (CRC mismatch).

warning: the debug information found in "/usr/lib/debug/usr/lib/libX11.so.6.2.0.debug" does not match "/usr/lib/libX11.so.6" (CRC mismatch).


Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/i386/i486/strlen.S:69
69	L(1):	movl (%eax), %ecx	/* get word (= 4 bytes) in question */
Current language:  auto; currently asm
Missing separate debuginfos, use: debuginfo-install cyrus-sasl-lib-2.1.22-19.fc10.i386 keyutils-libs-1.2-3.fc9.i386 libX11-1.1.5-2.fc10.i386 libXau-1.0.4-1.fc10.i386 libXdmcp-1.0.2-6.fc10.i386 libXpm-3.5.7-4.fc9.i386 libgcrypt-1.4.4-1.fc10.i386 libgpg-error-1.6-2.i386 libjpeg-6b-43.fc10.i386 libmcrypt-2.5.8-7.fc10.i386 libpng-1.2.35-1.fc10.i386 libselinux-2.0.78-1.fc10.i386 libssh2-0.18-7.fc9.i386 libtidy-0.99.0-17.20070615.fc9.i386 libxcb-1.1.91-5.fc10.i386 mhash-0.9.9-5.i386 mysql-libs-5.0.77-1.fc10.i386 nss-3.12.2.0-4.fc10.i386 openldap-2.4.12-1.fc10.i386 php-pecl-apc-3.0.19-1.fc10.i386 php-pecl-memcache-3.0.4-1.fc10.i386 php-pecl-xdebug-2.0.3-4.fc10.i386 sqlite-3.5.9-4.fc10.i386 t1lib-5.1.2-2.fc9.i386
(gdb) bt
#0  strlen () at ../sysdeps/i386/i486/strlen.S:69
#1  0x0014c342 in zif_idn_to_ascii (ht=1, return_value=0x846a5d4, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1) at /usr/src/debug/idn-1.2b/idn.c:700
#2  0x0822dc91 in execute_internal (execute_data_ptr=0xbfffd198, return_value_used=1) at /usr/src/debug/php-5.2.6/Zend/zend_execute.c:1373
#3  0x004c9d27 in xdebug_execute_internal () from /usr/lib/php/modules/xdebug.so
#4  0x08246ae0 in zend_do_fcall_common_helper_SPEC (execute_data=0xbfffd198) at /usr/src/debug/php-5.2.6/Zend/zend_vm_execute.h:202
#5  0x082322fb in execute (op_array=0x846aa8c) at /usr/src/debug/php-5.2.6/Zend/zend_vm_execute.h:92
#6  0x004c99c9 in xdebug_execute () from /usr/lib/php/modules/xdebug.so
#7  0x0820d0f0 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/src/debug/php-5.2.6/Zend/zend.c:1134
#8  0x081c3d6a in php_execute_script (primary_file=0xbffff61c) at /usr/src/debug/php-5.2.6/main/main.c:2005
#9  0x0828527c in main (argc=2, argv=0xbffff704) at /usr/src/debug/php-5.2.6/sapi/cli/php_cli.c:1140
Comment 1 Robert Scheck 2009-08-15 15:07:04 EDT
Gavin, thanks for your report. I'm able to reproduce that. Unfortunately I've
no clue how to fix it, as it seems not to be reproducible using idn(1), there
"xn--4gbrim" is returned for your string.

Note that if I use idn_to_ascii($str, "UTF-8") instead of your PHP line for 
output, everything works. The default is "ISO-8859-1" according to the C code, 
where your string is not a valid input then, I would assume...

Joe, Remi - ideas?
Comment 2 Bug Zapper 2009-11-18 06:42:16 EST
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 3 Tim Jackson 2009-11-18 19:00:15 EST
Reproduces for me with 

php-5.2.11-1.fc11.x86_64
php-idn-1.2-5.fc11.x86_64

I'd suggest filing an upstream bug on this.
Comment 4 Bug Zapper 2010-03-15 08:30:10 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 13 development cycle.
Changing version to '13'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 5 Bug Zapper 2011-06-02 14:09:50 EDT
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '13'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 13's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 13 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 6 Bug Zapper 2011-06-27 10:09:36 EDT
Fedora 13 changed to end-of-life (EOL) status on 2011-06-25. Fedora 13 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.