mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Fix NULL arithmetic during system program execution
For the first child process execution, `TWG(process)` is `NULL`; we need to catch that to avoid undefined behavior. Closes GH-17470.
This commit is contained in:
parent
e4473abefc
commit
022a5fca91
2 changed files with 10 additions and 6 deletions
2
NEWS
2
NEWS
|
@ -9,6 +9,8 @@ PHP NEWS
|
|||
(nielsdos)
|
||||
. Fixed bug GH-17214 (Relax final+private warning for trait methods with
|
||||
inherited final). (ilutov)
|
||||
. Fixed NULL arithmetic during system program execution on Windows. (cmb,
|
||||
nielsdos)
|
||||
|
||||
- Enchant:
|
||||
. Fix crashes in enchant when passing null bytes. (nielsdos)
|
||||
|
|
|
@ -374,14 +374,16 @@ static process_pair *process_get(FILE *stream)
|
|||
process_pair *ptr;
|
||||
process_pair *newptr;
|
||||
|
||||
for (ptr = TWG(process); ptr < (TWG(process) + TWG(process_size)); ptr++) {
|
||||
if (ptr->stream == stream) {
|
||||
break;
|
||||
if (TWG(process) != NULL) {
|
||||
for (ptr = TWG(process); ptr < (TWG(process) + TWG(process_size)); ptr++) {
|
||||
if (ptr->stream == stream) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr < (TWG(process) + TWG(process_size))) {
|
||||
return ptr;
|
||||
if (ptr < (TWG(process) + TWG(process_size))) {
|
||||
return ptr;
|
||||
}
|
||||
}
|
||||
|
||||
newptr = (process_pair*)realloc((void*)TWG(process), (TWG(process_size)+1)*sizeof(process_pair));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue