Commit e95083b
committed
uri: Fix lexbor memory management in uri_parser_whatwg.c
Calling `lexbor_mraw_clean()` after a specific number of parses will destroy
the data for any live `Uri\WhatWg\Url` objects, effectively resulting in a
use-after-free.
Fix the issue by removing the periodic `lexbor_mraw_clean()` call. Instead we
implement `php_uri_parser_whatwg_free()`. This also requires to move the
destruction of the lexbor structures from RSHUTDOWN to POST_ZEND_DEACTIVATE to
prevent a use-after-free in `php_uri_parser_whatwg_free()` since otherwise the
mraw would already have been destroyed.1 parent 5d5305d commit e95083b
File tree
4 files changed
+36
-24
lines changed- ext/uri
- tests
4 files changed
+36
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1084 | 1084 | | |
1085 | 1085 | | |
1086 | 1086 | | |
1087 | | - | |
| 1087 | + | |
1088 | 1088 | | |
1089 | | - | |
| 1089 | + | |
1090 | 1090 | | |
1091 | 1091 | | |
1092 | 1092 | | |
| |||
1101 | 1101 | | |
1102 | 1102 | | |
1103 | 1103 | | |
1104 | | - | |
| 1104 | + | |
1105 | 1105 | | |
1106 | 1106 | | |
1107 | | - | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
1108 | 1110 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
29 | 28 | | |
30 | | - | |
31 | 29 | | |
32 | 30 | | |
33 | 31 | | |
| |||
539 | 537 | | |
540 | 538 | | |
541 | 539 | | |
542 | | - | |
543 | | - | |
544 | 540 | | |
545 | 541 | | |
546 | 542 | | |
547 | | - | |
| 543 | + | |
548 | 544 | | |
549 | 545 | | |
550 | 546 | | |
551 | 547 | | |
552 | | - | |
553 | | - | |
554 | 548 | | |
555 | 549 | | |
556 | 550 | | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | 551 | | |
568 | 552 | | |
569 | | - | |
| 553 | + | |
570 | 554 | | |
571 | 555 | | |
572 | 556 | | |
| |||
619 | 603 | | |
620 | 604 | | |
621 | 605 | | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
622 | 609 | | |
623 | 610 | | |
624 | 611 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
0 commit comments