php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12565 array_map with NULL callback causes crash
Submitted: 2001-08-04 12:04 UTC Modified: 2001-08-04 12:50 UTC
From: matt at clevr dot com Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 4.0.6 OS: Mac OS X 10.0.4
Private report: No CVE-ID: None
 [2001-08-04 12:04 UTC] matt at clevr dot com
When used with NULL as the callback function, array_map 
causes a SIGBUS. 

Example: this crashes
<?php 
$a=array(1,2,3,4);
$b=array('a','b','c','d');
$c=array_map(NULL,$a,$b);
print_r(
$c);
?>
 

But this works:
<?php 
function foo($x,$y)
{
return array($x,$y);
}
$
a=ar
r
a
y(1,2,
3,4);
$
b=array('a','b','c',
'd
');
$c=array_map('foo
',
$a,$b);
print_r($c)
;
?> 

configure flags: --w
ith-apxs

Apache (1.3.14) l
og:

[Sat Aug
  4 
1
6
:
54:19 2001] [notice] child pid 18915 exit signal Bus erro
r (10)
[Sat Aug  4 16:
54:20 2001] [notice] child pid 18916 exit signal Bus erro
r (10)
[Sat Aug  4 16:
54:20 2001] [error] (22)Invalid argument: getsockname

gd
b backtrace:


Program received signal EXC_BAD_ACCESS, Could not access 
memory.
0x00c1ffac in _efree (ptr=0xbfffdf08) at zend_alloc.c:226
226             REMOVE_POINTER_FROM_LIST(p);
(gdb) bt
#0  0x00c1ffac in _efree (ptr=0xbfffdf08) at 
zend_alloc.c:226
#1  0x00c8fc98 in php_if_array_map (ht=3, return_value=
0x63e13c, this_ptr=0x0, return_value_used=13834456) at 
array.c:2999
#2  0x00c33384 in execute (op_array=0x5a079c) at ./
zend_execute.c:1504
#3  0x00c1fbe4 in zend_execute_scripts (type=-1073750264, 
file_count=3) at zend.c:752
#4  0x00c55a5c in php_execute_script (primary_file=
0xbffff558) at main.c:1206
#5  0x00c52b18 in apache_php_module_main (r=0xbfffdf08, 
display_source_mode=0) at sapi_apache.c:89
#6  0x00c515b8 in send_php (r=0x5990b4, 
display_source_mode=0, filename=0x0) at mod_php4.c:536
#7  0x00c515f4 in send_parsed_php (r=0xbfffdf08) at 
mod_php4.c:547
#8  0x0000c700 in ap_invoke_handler ()
#9  0x00016780 in process_request_internal ()
#10 0x000167fc in ap_process_request ()
#11 0x00005ec4 in child_main ()
#12 0x00006080 in make_child ()
#13 0x000061ec in startup_children ()
#14 0x000067f0 in standalone_main ()
#15 0x00007074 in main ()
#16 0x00002268 in _start ()
#17 0x000020a8 in start ()
#18 0x00000000 in ?? ()

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-04 12:08 UTC] matt at clevr dot com
I messed up the formatting, sorry
 [2001-08-04 12:50 UTC] andrei@php.net
Fixed in CVS.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 12:01:27 2024 UTC