Delayed OOM raised during compilation is dropped when compilation fails
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
Direzione di ricerca
Start in Zend/zend.c around the zend_execute_script() logic linked in the issue, then compare how delayed OOM is handled in sapi/fuzzer/fuzzer-sapi.c. Reproduce with the provided php -n commands and check the result when compilation fails. Done means the memory limit error is reported instead of the parse error in that case, while the no-) case still reports the memory error.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
If the main script exceeds memory_limit while being compiled and compilation then fails, the memory error is never reported. The parse error is reported instead. zend_execute_script() only handles a pending delayed OOM when zend_compile_file() returns an op_array:
https://github.com/php/php-src/blob/31c0ea7d7ff1d1fccb6492e52dab544011628065/Zend/zend.c#L1988-L1993
@bhaak found the same problem in sapi/fuzzer/fuzzer-sapi.c: https://github.com/php/php-src/commit/31c0ea7d7ff1d1fccb6492e52dab544011628065#r206151500. Their fix also applies here: handle the delayed OOM outside the if (op_array) block.
The following code:
php -n -r 'file_put_contents("oom.php", "<?php\n\$a = \x27" . str_repeat("A", 3 << 19) . "\x27;\n)\n");'
php -n -d memory_limit=4M oom.php
Resulted in this output:
Parse error: Unmatched ')' in oom.php on line 3
But I expected this output instead:
Fatal error: Allowed memory size of 4194304 bytes exhausted (tried to allocate 2097152 bytes) in oom.php on line 2
Without the ) line, the memory error is reported.
PHP Version
PHP 8.5.12-dev (cli) (NTS), built from 31c0ea7d7ff1d1fccb6492e52dab544011628065
Operating System
Linux x86_64
- Lingua principale
- C
- Stelle
- 40.7k
- Fork
- 8.3k
- Merge medio
- 2g 17h
- PR unite (30g)
- 159
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di php/php-src
-
`openssl_pkcs7_read()` / `openssl_cms_read()`: CRLs overwrite certificates in the output arrayApertaBug Status: Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
ext/mbstring: mb_regex_substitute() reads past the replacement string's end on a truncated trailing multibyte lead byteForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
php/php-src#24769 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
zend_set_local_var() overwrites existing compiled variable (CV) zval without calling zval_ptr_dtor()Forse già presa Una pull request collegata a questa issue è aperta o già unita. ApertaBug Status: Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
master: part of the mbstring bailout fix got lost in a mergeForse già presa @lazerg l’ha presa 6 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Bug Status: Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni
-
Abort (SIGABRT) when stderr is a closed pipe: uncaught fmt::system_error in ccache_main's catchForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 3 giorni
-
common/amount: parse_amount_sat misparses sub-satoshi msat with leading zero and accepts invalid suffixesForse già presa @bhuvan-somisetty l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ElementsProject/lightning#9674 ·
I maintainer di solito rispondono entro 1 giorno
-
mcp: a projectPath naming a file inside a project returns isError ("Path is not a directory")Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
colbymchenry/codegraph#2982 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno