php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79094 Crashing when running recursion function
Submitted: 2020-01-10 11:56 UTC Modified: 2020-01-10 14:22 UTC
From: vinayrachapalli7 at gmail dot com Assigned: dmitry (profile)
Status: Verified Package: Scripting Engine problem
PHP Version: 7.4Git-2020-01-10 (Git) OS: centos 7
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2020-01-10 11:56 UTC] vinayrachapalli7 at gmail dot com
Description:
------------
It crashes when we run the following script on PHP 7.4, but in 7.3, it'll through error like Fatal error: Allowed memory size of 134217728 bytes exhausted at ...

Test script:
---------------
<?php
function A(){
 A();
 }

A();
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-01-10 12:27 UTC] nikic@php.net
-Status: Open +Status: Verified -Package: PHP Language Specification +Package: Scripting Engine problem
 [2020-01-10 14:22 UTC] nikic@php.net
-Assigned To: +Assigned To: dmitry
 [2020-01-10 14:22 UTC] nikic@php.net
The problem here is that we don't SAVE_OPLINE in all places where an OOM condition might occur -- and I doubt we want to.

However, in 7.4 EX(opline) is no longer initialized at all (until a SAVE_OPLINE in a throwing opcode), which means that we may crash when trying to fetch the current line number on OOM.

I think that we should bring back EX(opline) initialization in init_func_execute_data. @dmitry: Do you see any other way?
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Jan 17 19:01:23 2020 UTC