Commit 423960a
authored
uri: Fix lexbor memory management in uri_parser_whatwg.c (#19591)
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 90822f7 commit 423960a
File tree
4 files changed
+35
-23
lines changed- ext/uri
- tests
4 files changed
+35
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1089 | 1089 | | |
1090 | 1090 | | |
1091 | 1091 | | |
1092 | | - | |
| 1092 | + | |
1093 | 1093 | | |
1094 | | - | |
| 1094 | + | |
1095 | 1095 | | |
1096 | 1096 | | |
1097 | 1097 | | |
| |||
1106 | 1106 | | |
1107 | 1107 | | |
1108 | 1108 | | |
1109 | | - | |
| 1109 | + | |
1110 | 1110 | | |
1111 | 1111 | | |
1112 | | - | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1113 | 1115 | | |
| 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 | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | 30 | | |
32 | | - | |
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
| |||
530 | 528 | | |
531 | 529 | | |
532 | 530 | | |
533 | | - | |
534 | | - | |
535 | 531 | | |
536 | 532 | | |
537 | 533 | | |
| |||
548 | 544 | | |
549 | 545 | | |
550 | 546 | | |
551 | | - | |
| 547 | + | |
552 | 548 | | |
553 | 549 | | |
554 | 550 | | |
| |||
557 | 553 | | |
558 | 554 | | |
559 | 555 | | |
560 | | - | |
561 | | - | |
562 | 556 | | |
563 | 557 | | |
564 | 558 | | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | 559 | | |
576 | 560 | | |
577 | | - | |
| 561 | + | |
578 | 562 | | |
579 | 563 | | |
580 | 564 | | |
| |||
624 | 608 | | |
625 | 609 | | |
626 | 610 | | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
627 | 614 | | |
628 | 615 | | |
629 | 616 | | |
| |||
| 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