Commit d2ea166
committed
http: fix use-after-free when freeParser is called during llhttp_execute
When pipelined requests arrive in one TCP segment, llhttp_execute()
parses them all in a single call. If a synchronous 'close' event
handler invokes freeParser() mid-execution, cleanParser() nulls out
parser state while llhttp_execute() is still on the stack, crashing on
the next callback.
Add an is_being_freed_ flag that freeParser() sets via
parser.markFreed() before cleaning state. Proxy::Raw checks the flag
before every callback and returns HPE_USER to abort execution early if
set.1 parent afc30b7 commit d2ea166
File tree
3 files changed
+37
-0
lines changed- lib
- src
- test/parallel
3 files changed
+37
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
626 | 632 | | |
627 | 633 | | |
628 | 634 | | |
| |||
1012 | 1018 | | |
1013 | 1019 | | |
1014 | 1020 | | |
| 1021 | + | |
1015 | 1022 | | |
1016 | 1023 | | |
1017 | 1024 | | |
| |||
1056 | 1063 | | |
1057 | 1064 | | |
1058 | 1065 | | |
| 1066 | + | |
1059 | 1067 | | |
1060 | 1068 | | |
1061 | 1069 | | |
| |||
1075 | 1083 | | |
1076 | 1084 | | |
1077 | 1085 | | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
1078 | 1089 | | |
1079 | 1090 | | |
1080 | 1091 | | |
| |||
1332 | 1343 | | |
1333 | 1344 | | |
1334 | 1345 | | |
| 1346 | + | |
1335 | 1347 | | |
1336 | 1348 | | |
1337 | 1349 | | |
| |||
1401 | 1413 | | |
1402 | 1414 | | |
1403 | 1415 | | |
| 1416 | + | |
1404 | 1417 | | |
1405 | 1418 | | |
1406 | 1419 | | |
| |||
| 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 | + | |
0 commit comments