Bug #81283 [NEW]: Integer overflow in shmop_read()
| From: | mr dot sol dot 7788 at gmail dot com | Date: | Fri, 23 Jul 2021 10:23:18 +0000 |
| Subject: | Bug #81283 [NEW]: Integer overflow in shmop_read() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-235297@lists.php.net to get a copy of this message | ||
From: mr dot sol dot 7788 at gmail dot com
Operating system: Linux
PHP version: Irrelevant
Package: Unknown/Other Function
Bug Type: Bug
Bug description:Integer overflow in shmop_read()
Description:
------------
PHP 7.4.3 (cli)
Zend Engine v3.4.0
Kubuntu (focal) - x86_64
PHP_INT_SIZE:8
PHP_INT_MAX:9223372036854775807
Created shared memeory with size 28991029248. Write in all diapozon is
normal.
Read bigest at position 2147483646 one byte.
shmop_read($shmp, 2147483647, 1)
getted error
Warning: shmop_read(): count is out of range in
Test script:
---------------
<?php
$KeyShm = ftok(__FILE__, 'a');
$shmp = shmop_open($KeyShm, 'n', 0644, 28991029248);
$WriteRes = shmop_write($shmp, "a", 2147483647);//All ok
$ReadRes1 = shmop_read($shmp, 2147483646, 1);//All ok
$ReadRes2 = shmop_read($shmp, 2147483647, 1);//Error
//Warning: shmop_read(): count is out of range in
echo "ReadRes2:'".($ReadRes2!==false?$ReadRes2:'false')."'
".PHP_EOL;
shmop_delete($shmp);
shmop_close($shmp);
Expected result:
----------------
ReadRes2:'a'
Actual result:
--------------
ReadRes2:'false'
--
Edit bug report at https://bugs.php.net/bug.php?id=81283&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81283&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81283&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81283&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81283&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81283&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81283&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81283&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81283&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81283&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81283&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81283&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81283&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81283&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81283&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81283&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81283&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81283&r=mysqlcfg