Repository navigation
Commit e7d430f
committed
fix(json): guard recursive parsing depth (#515)
Charge object and array recursion to the existing logical/native stack guard so hostile valid JSON throws the standard RangeError before Zig stack exhaustion. Protect the reviver walk through the same contract and preserve OutOfMemory, Throw, and internal control failures instead of relabeling them as SyntaxError.
Add a production-module subprocess gate for 50,000-level arrays and objects, 20,000 mixed containers, JSON.rawJSON, reviver traversal, a 96-level valid boundary, and malformed-syntax classification. Run it in CI normally and under TSan.
Before: the 50,000-array witness exited 139. After: it returns OK 42. Debug, ReleaseSafe, and TSan runtime gates pass; full unit gate is 1,544 passed, 1 expected skip, 0 failed/leaked; JSON.parse test262 remains 77/77, flips 0 cases.1 parent 4adcc0d commit e7d430f
4 files changed
Lines changed: 68 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
185 | 187 | | |
186 | 188 | | |
187 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1688 | 1688 | | |
1689 | 1689 | | |
1690 | 1690 | | |
| 1691 | + | |
1691 | 1692 | | |
1692 | 1693 | | |
1693 | 1694 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2983 | 2983 | | |
2984 | 2984 | | |
2985 | 2985 | | |
2986 | | - | |
| 2986 | + | |
| 2987 | + | |
| 2988 | + | |
| 2989 | + | |
| 2990 | + | |
| 2991 | + | |
2987 | 2992 | | |
2988 | 2993 | | |
2989 | 2994 | | |
| |||
3019 | 3024 | | |
3020 | 3025 | | |
3021 | 3026 | | |
3022 | | - | |
| 3027 | + | |
| 3028 | + | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
3023 | 3033 | | |
3024 | 3034 | | |
3025 | 3035 | | |
| |||
3041 | 3051 | | |
3042 | 3052 | | |
3043 | 3053 | | |
| 3054 | + | |
| 3055 | + | |
| 3056 | + | |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
3044 | 3060 | | |
3045 | 3061 | | |
3046 | 3062 | | |
| |||
3136 | 3152 | | |
3137 | 3153 | | |
3138 | 3154 | | |
3139 | | - | |
3140 | | - | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
| 3170 | + | |
| 3171 | + | |
3141 | 3172 | | |
3142 | 3173 | | |
3143 | 3174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
125 | 152 | | |
126 | 153 | | |
127 | 154 | | |
| |||
226 | 253 | | |
227 | 254 | | |
228 | 255 | | |
| 256 | + | |
| 257 | + | |
229 | 258 | | |
230 | 259 | | |
231 | 260 | | |
| |||
0 commit comments