File tree Expand file tree Collapse file tree 4 files changed +69
-0
lines changed Expand file tree Collapse file tree 4 files changed +69
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ PHP NEWS
2
2
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3
3
?? ??? 2022, PHP 8.0.16
4
4
5
+ - Core:
6
+ . Fixed bug #81430 (Attribute instantiation leaves dangling pointer).
7
+ (beberlei)
8
+
5
9
- FPM:
6
10
. Fixed memory leak on invalid port. (David Carlier)
7
11
Original file line number Diff line number Diff line change @@ -6315,6 +6315,7 @@ static int call_attribute_constructor(
6315
6315
dummy_func .type = ZEND_USER_FUNCTION ;
6316
6316
dummy_func .common .fn_flags =
6317
6317
attr -> flags & ZEND_ATTRIBUTE_STRICT_TYPES ? ZEND_ACC_STRICT_TYPES : 0 ;
6318
+ dummy_func .common .fn_flags |= ZEND_ACC_CALL_VIA_TRAMPOLINE ;
6318
6319
dummy_func .op_array .filename = filename ;
6319
6320
6320
6321
dummy_opline .opcode = ZEND_DO_FCALL ;
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #81430 (Attribute instantiation frame accessing invalid frame pointer)
3
+ --EXTENSIONS--
4
+ zend_test
5
+ --INI--
6
+ memory_limit=20M
7
+ zend_test.observer.enabled=1
8
+ zend_test.observer.observe_all=1
9
+ --FILE--
10
+ <?php
11
+
12
+ #[\Attribute]
13
+ class A {
14
+ private $ a ;
15
+ public function __construct () {
16
+ }
17
+ }
18
+
19
+ #[A]
20
+ function B () {}
21
+
22
+ $ r = new \ReflectionFunction ("B " );
23
+ call_user_func ([$ r ->getAttributes (A::class)[0 ], 'newInstance ' ]);
24
+ ?>
25
+ --EXPECTF--
26
+ <!-- init '%s' -->
27
+ <file '%s'>
28
+ <!-- init A::__construct() -->
29
+ <A::__construct>
30
+ </A::__construct>
31
+ </file '%s'>
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #81430 (Attribute instantiation leaves dangling execute_data pointer)
3
+ --EXTENSIONS--
4
+ zend_test
5
+ --INI--
6
+ memory_limit=20M
7
+ zend_test.observer.enabled=1
8
+ zend_test.observer.observe_all=1
9
+ --FILE--
10
+ <?php
11
+
12
+ #[\Attribute]
13
+ class A {
14
+ public function __construct () {
15
+ array_map ("str_repeat " , ["\xFF" ], [100000000 ]); // cause a bailout
16
+ }
17
+ }
18
+
19
+ #[A]
20
+ function B () {}
21
+
22
+ $ r = new \ReflectionFunction ("B " );
23
+ call_user_func ([$ r ->getAttributes (A::class)[0 ], 'newInstance ' ]);
24
+ ?>
25
+ --EXPECTF--
26
+ <!-- init '%s' -->
27
+ <file '%s'>
28
+ <!-- init A::__construct() -->
29
+ <A::__construct>
30
+
31
+ Fatal error: Allowed memory size of %d bytes exhausted %s in %s on line %d
32
+ </A::__construct>
33
+ </file '%s'>
You can’t perform that action at this time.
0 commit comments