[php-src] PR #11272: Fix GH-11240: PHP crashes on big file with array inside

From: Date: Thu, 18 May 2023 23:51:31 +0000
Subject: [php-src] PR #11272: Fix GH-11240: PHP crashes on big file with array inside
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-22536@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/11272 Author: nielsdos The crash happens because there's a stack overflow in the recursive SCC algorithm. Fix this by transforming it into an iterative implementation of the same algorithm. We manually keep the recursion stack now. I tested the correctness by running the CI test suite using both the old implementation and the new implementation and letting the test fail if the SCC values differ. The tests passed without failure. For the test case of OP, I benchmarked the performance: With this patch Time (mean ± σ): 645.9 ms ± 7.4 ms [User: 603.7 ms, System: 40.7 ms] Range (min … max): 634.0 ms … 659.3 ms 10 runs Without this patch Time (mean ± σ): 755.3 ms ± 18.1 ms [User: 698.8 ms, System: 55.2 ms] Range (min … max): 737.6 ms … 784.4 ms 10 runs We can see an improvement in performance as well because the function call overhead and control transfer overhead is eliminated now.

« previous php.git-pulls (#22536) next »