[php-src] PR #22428: Fix signed dbconvert() return stored into size_t in dblib lastInsertId
| From: | iliaal | Date: | Wed, 24 Jun 2026 11:22:17 +0000 |
| Subject: | [php-src] PR #22428: Fix signed dbconvert() return stored into size_t in dblib lastInsertId | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36594@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22428
Author: iliaal
dblib_handle_last_id() stored the DBINT return of dbconvert() into a size_t len. dbconvert() returns
-1 on conversion failure, which sign-extends to SIZE_MAX and is passed as the length to
zend_string_init(), reading far past the 40-byte buffer and requesting a SIZE_MAX allocation. Hold
the result in a DBINT and bail on a negative return, matching the failure-returns-NULL handling
already used for dbresults()/dbnextrow()/dbdatlen() earlier in the function. Triggering needs a live
SQL Server returning an unconvertible @@IDENTITY, so there is no portable red/green test; follow-up
to the buffer-overflow fix in #22348.