Skip to content

Commit

Permalink
Fix #76452: Crash while parsing blob data in firebird_fetch_blob
Browse files Browse the repository at this point in the history
This reapplies 286162e to the PHP-8.1 (and up)
branches, fixing what might have been caused by a bad merge conflict resolution.
  • Loading branch information
ramsey committed Jun 7, 2022
1 parent ef620d1 commit 74383b6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ext/pdo_firebird/firebird_statement.c
Expand Up @@ -305,7 +305,15 @@ static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, zval *result, ISC_QU
zend_ulong cur_len;
unsigned short seg_len;
ISC_STATUS stat;
zend_string *str = zend_string_alloc(len, 0);
zend_string *str;

/* prevent overflow */
if (len > ZSTR_MAX_LEN) {
result = 0;
goto fetch_blob_end;
}

str = zend_string_alloc(len, 0);

for (cur_len = stat = 0; (!stat || stat == isc_segment) && cur_len < len; cur_len += seg_len) {

Expand Down

0 comments on commit 74383b6

Please sign in to comment.