#36806 [NEW]: iconv_mime_decode case-sensitivity for encoding token ('B' or 'Q')
From: jgoldsmith at returnpath dot net Operating system: FC4 PHP version: 5.1.2 PHP Bug Type: ICONV related Bug description: iconv_mime_decode case-sensitivity for encoding token ('B' or 'Q') Description: iconv_mime_decode doesn't recognize lower-case encoding tokens ('b' or 'q'). These are acceptible according to the MIME RFC (http://www.ietf.org/rfc/rfc2047.txt). Here is a fix. Edit file: /ext/iconv/iconv.c Line: 1398 Change case 'B': to case 'B': case 'b': Line 1403 Change case 'Q': to case 'Q': case 'q': Reproduce code: --- $string = '=?UTF-8?b?VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZyE=?='; echo iconv_mime_decode($string,1); Expected result: This is an encoded string! Actual result: -- Warning: iconv_mime_decode() [function.iconv-mime-decode]: Malformed string -- Edit bug report at http://bugs.php.net/?id=36806&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36806&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36806&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36806&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36806&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36806&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36806&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=36806&r=needscript Try newer version:http://bugs.php.net/fix.php?id=36806&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36806&r=support Expected behavior:http://bugs.php.net/fix.php?id=36806&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36806&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36806&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36806&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36806&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36806&r=dst IIS Stability:http://bugs.php.net/fix.php?id=36806&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36806&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36806&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36806&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=36806&r=mysqlcfg
#35692 [Fbk->Opn]: iconv_mime_decode segmentation fault
ID: 35692 User updated by: jgoldsmith at returnpath dot net Reported By: jgoldsmith at returnpath dot net -Status: Feedback +Status: Open Bug Type: Reproducible crash Operating System: FC3 PHP Version: 5.1.1 New Comment: #0 0x060c7cf8 in libiconv (icd=0x, inbuf=0xbfca2d98, inbytesleft=0xbfca2d94, outbuf=0xbfca2d90, outbytesleft=0xbfca2d8c) at ./iconv.c:426 #1 0x01137153 in _php_iconv_appendl (d=0xbfca2ecc, s=0x8dc0ebc "=?ISO-8859-11?B?4L7U6MG7w9DK1Le41MDSvuPL6aHRuuCr1MPsv+DHzcPstOnHwiBEdWFsLUNvcmUgSW50ZWwoUikgWGVvbihSKSBQcm9jZXNzb3Ig48vB6A==?=", l=14, cd=0x) at /home/jgoldsmith/downloads/php-5.1.1/ext/iconv/iconv.c:254 #2 0x011397bf in _php_iconv_mime_decode (pretval=0xbfca2ecc, str=0x8dc0ebc "=?ISO-8859-11?B?4L7U6MG7w9DK1Le41MDSvuPL6aHRuuCr1MPsv+DHzcPstOnHwiBEdWFsLUNvcmUgSW50ZWwoUikgWGVvbihSKSBQcm9jZXNzb3Ig48vB6A==?=", str_nbytes=126, enc=0x8dc0d3c "UTF-8", next_pos=0x0, mode=2) at /home/jgoldsmith/downloads/php-5.1.1/ext/iconv/iconv.c:1369 #3 0x0113a9c3 in zif_iconv_mime_decode (ht=3, return_value=0x8dc0fac, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1) at /home/jgoldsmith/downloads/php-5.1.1/ext/iconv/iconv.c:2053 #4 0x013082db in zend_do_fcall_common_helper_SPEC (execute_data=0xbfca3074) at /home/jgoldsmith/downloads/php-5.1.1/Zend/zend_vm_execute.h:188 #5 0x0130d0a3 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0xbfca3074) at /home/jgoldsmith/downloads/php-5.1.1/Zend/zend_vm_execute.h:1578 #6 0x01307f56 in execute (op_array=0x8dc0c7c) at /home/jgoldsmith/downloads/php-5.1.1/Zend/zend_vm_execute.h:88 #7 0x012de414 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/jgoldsmith/downloads/php-5.1.1/Zend/zend.c:1090 #8 0x0129a6c4 in php_execute_script (primary_file=0xbfca5424) at /home/jgoldsmith/downloads/php-5.1.1/main/main.c:1704 #9 0x013544f3 in php_handler (r=0x8db1eb8) at /home/jgoldsmith/downloads/php-5.1.1/sapi/apache2handler/sapi_apache2.c:584 #10 0x08067a2a in ap_run_handler (r=0x8db1eb8) at config.c:152 #11 0x08067da2 in ap_invoke_handler (r=0x8db1eb8) at config.c:364 #12 0x080654f5 in ap_process_request (r=0x8db1eb8) at http_request.c:249 #13 0x08060db5 in ap_process_http_connection (c=0x8dabc20) at http_core.c:251 #14 0x080702de in ap_run_process_connection (c=0x8dabc20) at connection.c:43 #15 0x080661ca in child_main (child_num_arg=Variable "child_num_arg" is not available. ) at prefork.c:610 #16 0x0806637d in make_child (s=0x8bf8e88, slot=0) at prefork.c:650 #17 0x08066446 in startup_children (number_to_start=5) at prefork.c:722 #18 0x08066c08 in ap_mpm_run (_pconf=0x8bf70a8, plog=0x8c23158, s=0x8bf8e88) at prefork.c:941 #19 0x0806bf83 in main (argc=2, argv=0xbfca5864) at main.c:618 Previous Comments: [2005-12-15 22:35:45] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php for *NIX and http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32 Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. ------------ [2005-12-15 22:30:51] jgoldsmith at returnpath dot net Description: When calling iconv_mime_decode to decode between an unrecognized charset to UTF-8, PHP throws a segmentation fault. It only happens when mode=2 ./configure --with-iconv=/usr/local/lib I would expect it to just return the original string if it doesn't recognize the charset. Reproduce code: --- $string = "=?ISO-8859-11?B?4L7U6MG7w9DK1Le41MDSvuPL6aHRuuCr1MPsv+DHzcPstOnHwiBEdWFsLUNvcmUgSW50ZWwoUikgWGVvbihSKSBQcm9jZXNzb3Ig48vB6A==?="; $string2 = iconv_mime_decode($string,2,'UTF-8'); var_dump($string2); Expected result: I expect to get the original string back Actual result: -- Segmentation Fault -- Edit this bug report at http://bugs.php.net/?id=35692&edit=1
#35692 [NEW]: iconv_mime_decode segmentation fault
From: jgoldsmith at returnpath dot net Operating system: FC3 PHP version: 5.1.1 PHP Bug Type: Reproducible crash Bug description: iconv_mime_decode segmentation fault Description: When calling iconv_mime_decode to decode between an unrecognized charset to UTF-8, PHP throws a segmentation fault. It only happens when mode=2 ./configure --with-iconv=/usr/local/lib I would expect it to just return the original string if it doesn't recognize the charset. Reproduce code: --- $string = "=?ISO-8859-11?B?4L7U6MG7w9DK1Le41MDSvuPL6aHRuuCr1MPsv+DHzcPstOnHwiBEdWFsLUNvcmUgSW50ZWwoUikgWGVvbihSKSBQcm9jZXNzb3Ig48vB6A==?="; $string2 = iconv_mime_decode($string,2,'UTF-8'); var_dump($string2); Expected result: I expect to get the original string back Actual result: -- Segmentation Fault -- Edit bug report at http://bugs.php.net/?id=35692&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35692&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35692&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35692&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35692&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35692&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35692&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=35692&r=needscript Try newer version:http://bugs.php.net/fix.php?id=35692&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35692&r=support Expected behavior:http://bugs.php.net/fix.php?id=35692&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35692&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35692&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35692&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35692&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35692&r=dst IIS Stability:http://bugs.php.net/fix.php?id=35692&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35692&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35692&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35692&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=35692&r=mysqlcfg