Bug #81252 [NEW]: PDO_ODBC doesn't account for SQL_NO_TOTAL
| From: | calvin at cmpct dot info | Date: | Mon, 12 Jul 2021 16:40:28 +0000 |
| Subject: | Bug #81252 [NEW]: PDO_ODBC doesn't account for SQL_NO_TOTAL | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-234987@lists.php.net to get a copy of this message | ||
From: calvin at cmpct dot info
Operating system: Fedora 34
PHP version: 7.4.21
Package: PDO ODBC
Bug Type: Bug
Bug description:PDO_ODBC doesn't account for SQL_NO_TOTAL
Description:
------------
Similar to #80460 for procedural ODBC (which was fixed, though perhaps
with not an ideal solution). This will manifest as PDO_ODBC getting -4
as the length back from the driver, and blindly trying to memcpy that
length, crashing.
Test script:
---------------
https://gist.github.com/NattyNarwhal/e1209fc967b0f4dcdfba7d2405557077
Includes reproduction for Db2i.
Expected result:
----------------
object(stdClass)#3 (4) {
["ID"]=>
&string(1) "1"
["Data1"]=>
&string(20) "5char "
["Data2"]=>
&string(25) "xxxxxxxxxxxxxxxxxxx "
["Data3"]=>
&string(2) "19"
}
Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff77cbac6 in __memcpy_avx_unaligned_erms () from
/lib64/libc.so.6
(gdb) where
#0 0x00007ffff77cbac6 in __memcpy_avx_unaligned_erms () from
/lib64/libc.so.6
#1 0x00007fffe419a274 in memcpy (__len=18446744073709551612,
__src=0x7ffff72010c0, __dest=<optimized out>) at
/usr/include/bits/string_fortified.h:29
#2 odbc_stmt_param_hook (stmt=<optimized out>, param=<optimized out>,
event_type=<optimized out>) at
/usr/src/debug/php-7.4.21-1.fc34.x86_64/ext/pdo_odbc/odbc_stmt.c:522
#3 0x00007fffe44b51ee in dispatch_param_event
(event_type=PDO_PARAM_EVT_EXEC_POST, stmt=0x7ffff7287000) at
/usr/src/debug/php-7.4.21-1.fc34.x86_64/ext/pdo/pdo_stmt.c:179
#4 dispatch_param_event (stmt=0x7ffff7287000,
event_type=PDO_PARAM_EVT_EXEC_POST) at
/usr/src/debug/php-7.4.21-1.fc34.x86_64/ext/pdo/pdo_stmt.c:160
#5 0x00007fffe44b5e6d in zim_PDOStatement_execute
(execute_data=<optimized out>, return_value=0x7fffffff9d10) at
/usr/src/debug/php-7.4.21-1.fc34.x86_64/ext/pdo/pdo_stmt.c:520
#6 0x0000555555855e0b in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at
/usr/src/debug/php-7.4.21-1.fc34.x86_64/Zend/zend_vm_execute.h:1618
#7 execute_ex (ex=0x7ffff72010f0) at
/usr/src/debug/php-7.4.21-1.fc34.x86_64/Zend/zend_vm_execute.h:53897
#8 0x00005555558583af in zend_execute (op_array=0x7ffff72812a0,
return_value=0x0) at
/usr/src/debug/php-7.4.21-1.fc34.x86_64/Zend/zend_vm_execute.h:57993
#9 0x00005555557cf42c in zend_execute_scripts (type=type@entry=8,
retval=0x7fffdc8695a0, retval@entry=0x0, file_count=-148819936,
file_count@entry=3) at
/usr/src/debug/php-7.4.21-1.fc34.x86_64/Zend/zend.c:1679
#10 0x000055555576cf88 in php_execute_script (primary_file=<optimized
out>) at /usr/src/debug/php-7.4.21-1.fc34.x86_64/main/main.c:2650
#11 0x000055555585a537 in do_cli (argc=2, argv=0x555555e21020) at
/usr/src/debug/php-7.4.21-1.fc34.x86_64/sapi/cli/php_cli.c:964
#12 0x000055555563c44b in main (argc=2, argv=0x555555e21020) at
/usr/src/debug/php-7.4.21-1.fc34.x86_64/sapi/cli/php_cli.c:1359
--
Edit bug report at https://bugs.php.net/bug.php?id=81252&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81252&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81252&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81252&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81252&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81252&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81252&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81252&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81252&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81252&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81252&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81252&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81252&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81252&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81252&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81252&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81252&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81252&r=mysqlcfg