cvs: php-src /ext/standard streamsfuncs.c /ext/standard/tests/streams bug44712.phpt
| From: | Hannes Magnusson | Date: | Sun, 13 Apr 2008 22:40:35 +0000 |
| Subject: | cvs: php-src /ext/standard streamsfuncs.c /ext/standard/tests/streams bug44712.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-49609@lists.php.net to get a copy of this message | ||
bjori Sun Apr 13 22:40:35 2008 UTC
Modified files:
/php-src/ext/standard streamsfuncs.c
/php-src/ext/standard/tests/streams bug44712.phpt
Log:
MFB5.3: Fixed bug#44712 (stream_context_set_params segfaults on invalid arguments)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.113&r2=1.114&diff_format=u
Index: php-src/ext/standard/streamsfuncs.c
diff -u php-src/ext/standard/streamsfuncs.c:1.113 php-src/ext/standard/streamsfuncs.c:1.114
--- php-src/ext/standard/streamsfuncs.c:1.113 Thu Feb 28 14:16:14 2008
+++ php-src/ext/standard/streamsfuncs.c Sun Apr 13 22:40:35 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streamsfuncs.c,v 1.113 2008/02/28 14:16:14 felipe Exp $ */
+/* $Id: streamsfuncs.c,v 1.114 2008/04/13 22:40:35 bjori Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -972,7 +972,11 @@
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;
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/bug44712.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/streams/bug44712.phpt
diff -u /dev/null php-src/ext/standard/tests/streams/bug44712.phpt:1.2
--- /dev/null Sun Apr 13 22:40:35 2008
+++ php-src/ext/standard/tests/streams/bug44712.phpt Sun Apr 13 22:40:35 2008
@@ -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
+