Skip to content

Commit ce534c6

Browse files
authored
Fix phpGH-19961: Static analysis arrayIndexThenCheck warning in firebird (php#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()
1 parent 2709ebc commit ce534c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/pdo_firebird/firebird_driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const zend_string *sql) /*
632632
ret = -1;
633633
goto free_statement;
634634
}
635-
while (result[i] != isc_info_end && i < result_size) {
635+
while (i < result_size && result[i] != isc_info_end) {
636636
short len = (short)isc_vax_integer(&result[i+1],2);
637637
/* bail out on bad len */
638638
if (len != 1 && len != 2 && len != 4) {

0 commit comments

Comments
 (0)