Skip to content

Commit 6f8045c

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #79427: Integer Overflow in shmop_open()
2 parents 0b4e80b + a681b12 commit 6f8045c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ PHP NEWS
2525
. Fixed bug #79412 (Opcache chokes and uses 100% CPU on specific script).
2626
(Dmitry)
2727

28+
- Shmop:
29+
. Fixed bug #79427 (Integer Overflow in shmop_open()). (cmb)
30+
2831
- SimpleXML:
2932
. Fixed bug #61597 (SXE properties may lack attributes and content). (cmb)
3033

ext/shmop/shmop.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ PHP_FUNCTION(shmop_open)
207207
goto err;
208208
}
209209

210+
if (shm.shm_segsz > ZEND_LONG_MAX) {
211+
php_error_docref(NULL, E_WARNING, "shared memory segment too large to attach");
212+
goto err;
213+
}
214+
210215
shmop->addr = shmat(shmop->shmid, 0, shmop->shmatflg);
211216
if (shmop->addr == (char*) -1) {
212217
php_error_docref(NULL, E_WARNING, "unable to attach to shared memory segment '%s'", strerror(errno));

0 commit comments

Comments
 (0)