![]() |
![]() | #1 |
панаехавший Join Date: 06 2003 Location: форпост Age: 33
Posts: 4,007
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
Ok, I don't have much time do a lot of investigation. Below goes some recursive code. It causes apache.exe to crash when php5 is loaded as a module and php.exe to crash if the latter is run as a cgi executable. I find that the problem is in the recursion itself, though other recursive code goes well. Can anybody help? PHP Code:
__________________ Իսկ ԴՈՒ արդեն վաճառե՞լ ես Հայրենիքդ ռուսներին: My Exchange Rate Monitor | Իմ Արտարժույթի Մոնիտորը |
![]() |
![]() | #2 |
панаехавший Join Date: 06 2003 Location: форпост Age: 33
Posts: 4,007
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
I did a couplee of tests. Seems php.exe crashes when thrown into an infinite recursion cycle. Btw, the same happens with 4.x.x . Can anybody confirm or try that on a linux box? |
![]() |
![]() | #3 |
Moderator Join Date: 09 2001 Location: South Korea, Gumi
Posts: 7,699
Blog Entries: 16 Downloads: 102 Uploads: 34
Reputation: 561 | 6 | ![]()
So the problem is to prevent code from running into infinite recursion or to teach php not to crash? ![]() It's kinda hard to test this code, since in my understanding this is a part of some class, where the other member variables and functions are being used. In order to be able to test this code you should provide either the full class with testing part or simplified extraction of problematic part. |
![]() |
![]() | #4 |
панаехавший Join Date: 06 2003 Location: форпост Age: 33
Posts: 4,007
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
No, actually you don't need the whole class, the following code will end up with an exception. Code: <?php function foo() { foo(); } foo(); ?> ![]() ![]() |
![]() |
![]() | #5 |
Moderator Join Date: 09 2001 Location: South Korea, Gumi
Posts: 7,699
Blog Entries: 16 Downloads: 102 Uploads: 34
Reputation: 561 | 6 | ![]()
I won't consider this is as a bug, because the program's stack can't be made of rubber. Stack overflow is a common thing and developer's responsibility is to prevent such situations. Throwing an exception is proper thing in this case, so developer will know that there is potential unsafe place in his code. Cheers. |
![]() |
![]() | #6 | |
панаехавший Join Date: 06 2003 Location: форпост Age: 33
Posts: 4,007
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]() Quote:
After all, there are a lot of vulnerable scripts around the web which will let you execute php script on the server, but generally that won't be of much good to the bad guy. But what if the bad guy gets off executing php code resulting in a stack overflow? ... | |
![]() |
Sponsored Links |
![]() |
Thread Tools | |
|
На правах рекламы: | |
![]() | |