com php-src: Fixed bug #70876 Segmentation fault when regenerating session id with strict mode: ext/session/mod_files.c ext/session/
tests/bug70876.phpt
| From: | Reeze Xia | Date: | Sat, 07 Nov 2015 13:46:21 +0000 |
| Subject: | com php-src: Fixed bug #70876 Segmentation fault when regenerating session id with strict mode: ext/session/mod_files.c ext/session/ tests/bug70876.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89631@lists.php.net to get a copy of this message | ||
Commit: 0bf3ebb4ba77f38261d9cb21a205a7d31b7f85cf
Author: Reeze Xia <reeze@php.net> Sat, 7 Nov 2015 21:46:21 +0800
Parents: 99d818f1e901d4eb411a6458a7800df071d8284a
Branches: PHP-7.0
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0bf3ebb4ba77f38261d9cb21a205a7d31b7f85cf
Log:
Fixed bug #70876 Segmentation fault when regenerating session id with strict mode
The comment *mod_data always be non-NULL is not true.
The same as this FIXME: https://github.com/php/php-src/blob/master/ext/session/mod_files.c#L676
Bugs:
https://bugs.php.net/70876
Changed paths:
M ext/session/mod_files.c
A ext/session/tests/bug70876.phpt
Diff:
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index 8301b73..933df93 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -702,6 +702,10 @@ PS_VALIDATE_SID_FUNC(files)
{
PS_FILES_DATA;
+ if (!data) {
+ return FAILURE;
+ }
+
return ps_files_key_exists(data, ZSTR_VAL(key));
}
diff --git a/ext/session/tests/bug70876.phpt b/ext/session/tests/bug70876.phpt
new file mode 100644
index 0000000..33e0323
--- /dev/null
+++ b/ext/session/tests/bug70876.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #70876 Segmentation fault when regenerating session id with strict mode
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+html_errors=0
+session.save_handler=files
+--FILE--
+<?php
+ini_set('session.use_strict_mode', true);
+session_start();
+session_regenerate_id();
+
+echo "ok";
+?>
+--EXPECT--
+ok
\ No newline at end of file