php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22629 Run-time seg fault with core dump
Submitted: 2003-03-10 21:10 UTC Modified: 2003-03-10 23:50 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: cs19291 at kaist dot ac dot kr Assigned:
Status: Wont fix Package: Reproducible crash
PHP Version: 4.3.1 OS: RedHat 7.2
Private report: No CVE-ID: None
 [2003-03-10 21:10 UTC] cs19291 at kaist dot ac dot kr
When playing with php 4.1.2 using command-line interpreter, I noticed that the code below generates seg fault and produces core dump. After that, I installed 4.3.1 cgi version for only interpreting purpose, still facing core dump.

The one who is interesting at functional programming style will at once understand what the code represents.

I know "_map" can be never run under php, because it generates infinite frame stack, not likely under the functional language interpreter. However, it causes a crash.

The code:
http://tempdoc.ek-project.com/crash.txt

Or the simplist version:
http://tempdoc.ek-project.com/simple.txt

This is also interesting:
http://tempdoc.ek-project.com/simple-alt.txt
It does not complain of the number of arguments, just dies.

The link can be broken sometime.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-10 21:34 UTC] iliaa@php.net
Congratulations, you've discovered a bug, NOT!

The code is crashing because you are very effectively overflowing the stack. This is a known an expected behaviour when using unterminated resursive loops. The solution is not to use recursive loops or put hard limits to prevent stack overflows.

In the future please review existing bug reports to see if similar issues have already been covered.
 [2003-03-10 22:04 UTC] cs19291 at kaist dot ac dot kr
Thank you for your feedbacks.

But, the first code I supplied (the longest one) doesn't have any logical infinite loop. It really terminates. The first version of "map" correctly outputs the sum of 1 through 10. It has obviously a hard limit.
 [2003-03-10 23:50 UTC] cs19291 at kaist dot ac dot kr
Okay, I finally decided that this is not a bug. Anonyone who sees this page doesn't have to look deep inside.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 06:01:28 2024 UTC