1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix GH-19961: Static analysis arrayIndexThenCheck warning in firebird (#20790)

Static analysis reports that the bounds check comes after reading the
byte from the buffer.
In practice, this is tagged data that loops until the end tag is found
and therefore there isn't really a bug. The extra length check is only
there for extra hardening.
So we simply silence the static analysers and improve the hardening.

See also https://docwiki.embarcadero.com/InterBase/15/en/Isc_dsql_sql_info()
This commit is contained in:
Niels Dossche
2025-12-28 04:04:16 -08:00
committed by GitHub
parent 2709ebc0ce
commit ce534c612b

View File

@@ -632,7 +632,7 @@ static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const zend_string *sql) /*
ret = -1;
goto free_statement;
}
while (result[i] != isc_info_end && i < result_size) {
while (i < result_size && result[i] != isc_info_end) {
short len = (short)isc_vax_integer(&result[i+1],2);
/* bail out on bad len */
if (len != 1 && len != 2 && len != 4) {