|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchespatch-apc_cache.c (last revision 2016-08-10 11:28 UTC by jaromird at microsoft dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-08-10 11:29 UTC] jaromird at microsoft dot com
[2016-08-10 12:03 UTC] nikic@php.net
-Assigned To:
+Assigned To: krakjoe
[2016-08-10 12:03 UTC] nikic@php.net
[2016-09-29 09:49 UTC] krakjoe@php.net
-Status: Assigned
+Status: Closed
[2016-09-29 09:49 UTC] krakjoe@php.net
[2016-10-14 14:28 UTC] jaromird at microsoft dot com
[2016-10-14 14:33 UTC] requinix@php.net
[2016-10-14 14:35 UTC] requinix@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 06:00:01 2025 UTC |
Description: ------------ Started seeing more frequent Apache crashes after upgrade to PHP 7.0 for one of our applications which makes heavy use of apc cache. After investigation, found a reproduction script to trigger segmentation fault eventually. Late apcu code inspection revealed that code doesn't check for memory allocation failures on many places. Typical case for example: string duplication fails in apcu_store(), code then inserts zval with NULL value into cache, then apcu_fetch() crashes when dereferencing the value. I hope I've covered all necessary places in the patch, but surely would suggest close review. So far only the case triggered by the below test is really tested. Test script: --------------- <?php /* Might need tweaking to trigger the memory allocation failure ini settings: memory_limit = 4512M apcu shared memory size default - 128M */ $f = str_repeat('c', 800 * 1024 * 1024 ); apcu_store('aaa', $f, 5); $s = apcu_fetch('aaa'); echo ($s == $f) ? "same" : "different"; Expected result: ---------------- script running to completion, returning "same" if no memory problem, "different" if memory allocation failure in apc_fetch() Actual result: -------------- Segmentation fault: 11