File tree 3 files changed +58
-1
lines changed
3 files changed +58
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ PHP NEWS
2
2
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3
3
?? ??? ????, PHP 7.4.27
4
4
5
+ - FPM:
6
+ . Fixed bug #81513 (Future possibility for heap overflow in FPM zlog).
7
+ (Jakub Zelenka)
8
+
5
9
- GD:
6
10
. Fixed bug #71316 (libpng warning from imagecreatefromstring). (cmb)
7
11
Original file line number Diff line number Diff line change @@ -414,7 +414,8 @@ static inline ssize_t zlog_stream_unbuffered_write(
414
414
static inline ssize_t zlog_stream_buf_copy_cstr (
415
415
struct zlog_stream * stream , const char * str , size_t str_len ) /* {{{ */
416
416
{
417
- if (stream -> buf .size - stream -> len <= str_len && !zlog_stream_buf_alloc_ex (stream , str_len )) {
417
+ if (stream -> buf .size - stream -> len <= str_len &&
418
+ !zlog_stream_buf_alloc_ex (stream , str_len + stream -> len )) {
418
419
return -1 ;
419
420
}
420
421
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ FPM: bug81513 - Buffered worker output plain log stream reallocation
3
+ --SKIPIF--
4
+ <?php include "skipif.inc " ; ?>
5
+ --FILE--
6
+ <?php
7
+
8
+ require_once "tester.inc " ;
9
+
10
+ $ cfg = <<<EOT
11
+ [global]
12
+ error_log = {{FILE:LOG}}
13
+ [unconfined]
14
+ listen = {{ADDR}}
15
+ pm = dynamic
16
+ pm.max_children = 5
17
+ pm.start_servers = 1
18
+ pm.min_spare_servers = 1
19
+ pm.max_spare_servers = 3
20
+ catch_workers_output = yes
21
+ decorate_workers_output = no
22
+ EOT ;
23
+
24
+ $ code = <<<EOT
25
+ <?php
26
+ file_put_contents('php://stderr', str_repeat('a', 100));
27
+ usleep(20000);
28
+ file_put_contents('php://stderr', str_repeat('b', 2500) . " \n");
29
+ EOT ;
30
+
31
+ $ tester = new FPM \Tester ($ cfg , $ code );
32
+ $ tester ->start ();
33
+ $ tester ->expectLogStartNotices ();
34
+ $ tester ->request ()->expectEmptyBody ();
35
+ $ tester ->terminate ();
36
+ var_dump ($ tester ->getLastLogLine () === str_repeat ('a ' , 100 ) . str_repeat ('b ' , 923 ) . "\n" );
37
+ var_dump ($ tester ->getLastLogLine () === str_repeat ('b ' , 1023 ) . "\n" );
38
+ var_dump ($ tester ->getLastLogLine () === str_repeat ('b ' , 554 ) . "\n" );
39
+ $ tester ->close ();
40
+
41
+ ?>
42
+ Done
43
+ --EXPECT--
44
+ bool(true)
45
+ bool(true)
46
+ bool(true)
47
+ Done
48
+ --CLEAN--
49
+ <?php
50
+ require_once "tester.inc " ;
51
+ FPM \Tester::clean ();
52
+ ?>
You can’t perform that action at this time.
0 commit comments