Skip to content

Commit ee25eb0

Browse files
committed
Fixed #73496 (Invalid memory access in zend_inline_hash_func)
no test script is added because it requre too much memory
1 parent 981c587 commit ee25eb0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ PHP NEWS
3939
. Fixed bug #73118 (is_callable callable name reports misleading value for
4040
anonymous classes). (Adam Saponara)
4141

42+
- Streams:
43+
. Fixed bug #73496 (Invalid memory access in zend_inline_hash_func).
44+
(Laruence)
45+
4246

4347
16 Feb 2017 PHP 7.0.16
4448

main/streams/filter.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,18 +252,18 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval
252252
HashTable *filter_hash = (FG(stream_filters) ? FG(stream_filters) : &stream_filters_hash);
253253
php_stream_filter_factory *factory = NULL;
254254
php_stream_filter *filter = NULL;
255-
int n;
255+
size_t n;
256256
char *period;
257257

258-
n = (int)strlen(filtername);
258+
n = strlen(filtername);
259259

260260
if (NULL != (factory = zend_hash_str_find_ptr(filter_hash, filtername, n))) {
261261
filter = factory->create_filter(filtername, filterparams, persistent);
262262
} else if ((period = strrchr(filtername, '.'))) {
263263
/* try a wildcard */
264264
char *wildname;
265265

266-
wildname = emalloc(n+3);
266+
wildname = safe_emalloc(1, n, 3);
267267
memcpy(wildname, filtername, n+1);
268268
period = wildname + (period - filtername);
269269
while (period && !filter) {

0 commit comments

Comments
 (0)