Commit c3eb187
n-api: avoid crash in napi_escape_scope()
V8 will crash if escape is called twice on the same
scope.
Add checks to avoid crashing if napi_escape_scope() is
called to try and do this.
Add test that tries to call napi_create_scope() twice.
Backport-PR-URL: #19447
PR-URL: #13651
Reviewed-By: Jason Ginchereau <jasongin@microsoft.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>1 parent cc3a4af commit c3eb187
File tree
4 files changed
+44
-8
lines changed- src
- test/addons-napi/test_handle_scope
4 files changed
+44
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
160 | 162 | | |
161 | 163 | | |
162 | 164 | | |
163 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
164 | 170 | | |
165 | 171 | | |
| 172 | + | |
166 | 173 | | |
167 | 174 | | |
168 | 175 | | |
169 | 176 | | |
170 | 177 | | |
| 178 | + | |
171 | 179 | | |
172 | 180 | | |
173 | 181 | | |
| |||
720 | 728 | | |
721 | 729 | | |
722 | 730 | | |
723 | | - | |
| 731 | + | |
| 732 | + | |
724 | 733 | | |
725 | 734 | | |
726 | 735 | | |
| |||
748 | 757 | | |
749 | 758 | | |
750 | 759 | | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
751 | 764 | | |
752 | | - | |
| 765 | + | |
753 | 766 | | |
754 | | - | |
| 767 | + | |
755 | 768 | | |
756 | 769 | | |
757 | 770 | | |
| |||
2213 | 2226 | | |
2214 | 2227 | | |
2215 | 2228 | | |
2216 | | - | |
2217 | | - | |
2218 | | - | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
2219 | 2235 | | |
2220 | 2236 | | |
2221 | 2237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
13 | 19 | | |
14 | 20 | | |
15 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
32 | 45 | | |
33 | 46 | | |
34 | 47 | | |
| |||
57 | 70 | | |
58 | 71 | | |
59 | 72 | | |
| 73 | + | |
60 | 74 | | |
61 | 75 | | |
62 | 76 | | |
| |||
0 commit comments