mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
MFB5.3: Fixed bug#44712 (stream_context_set_params segfaults on invalid arguments)
This commit is contained in:
parent
b34cf3d86f
commit
1972f83385
2 changed files with 15 additions and 1 deletions
|
@ -972,7 +972,11 @@ static int parse_context_params(php_stream_context *context, zval *params TSRMLS
|
|||
context->notifier->dtor = user_space_stream_notifier_dtor;
|
||||
}
|
||||
if (SUCCESS == zend_ascii_hash_find(Z_ARRVAL_P(params), "options", sizeof("options"), (void**)&tmp)) {
|
||||
parse_context_options(context, *tmp TSRMLS_CC);
|
||||
if (Z_TYPE_PP(tmp) == IS_ARRAY) {
|
||||
parse_context_options(context, *tmp TSRMLS_CC);
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter");
|
||||
}
|
||||
}
|
||||
if (SUCCESS == zend_ascii_hash_find(Z_ARRVAL_P(params), "encoding", sizeof("encoding"), (void**)&tmp)) {
|
||||
zval strval = **tmp;
|
||||
|
|
10
ext/standard/tests/streams/bug44712.phpt
Normal file
10
ext/standard/tests/streams/bug44712.phpt
Normal file
|
@ -0,0 +1,10 @@
|
|||
--TEST--
|
||||
bug#44712 (stream_context_set_params segfaults on invalid arguments)
|
||||
--FILE--
|
||||
<?php
|
||||
$ctx = stream_context_get_default();
|
||||
stream_context_set_params($ctx, array("options" => 1));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: stream_context_set_params(): Invalid stream/context parameter in %sbug44712.php on line %s
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue