std.parseJson / std.parseYaml: number overflow (out_of_range.406) aborts the process
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 78/100
Research direction
Inspect libjsonnet.cpp, starting with builtinParseJson and the json::parse call used by builtinParseYaml. Run the provided build and jsonnet reproductions first; done means overflowing JSON and YAML numbers produce a Jsonnet RuntimeError rather than escaping to CATCH and aborting, while the existing parse-error behavior remains intact.
Written by the indexing model from the issue text.
Description
std.parseJson only catches nlohmann::json::parse_error. Overflowing numbers raise out_of_range.406, which escapes to CATCH in libjsonnet.cpp and abort()s. Same for std.parseYaml("1E999") (RapidYAML → json::parse without catching out_of_range).
Same gap as #680 / #951 (parse_error only). Tip 2ef32ab / CLI v0.22.0.
Repro
git clone https://github.com/google/jsonnet.git
cd jsonnet && make -j$(nproc)
./jsonnet -e 'std.parseJson("1E999")'
… out_of_range.406 … number overflow parsing '1E999'
Aborted (core dumped) # exit 134
./jsonnet -e 'std.parseYaml("1E999")' → same abort.
./jsonnet -e 'std.parseJson("{")' → RuntimeError, no abort.
./jsonnet -e 'std.parseJson("1e2")' → 100.
Fix
Catch json::exception (or out_of_range) in builtinParseJson and around json::parse in builtinParseYaml; throw makeError(...) like #951.
- Dominant language
- Jsonnet
- Stars
- 7.6k
- Forks
- 475
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google/jsonnet
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
std.format: wrong digits for %f/%d on large values; malformed output for non-integer * precision Open
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
Difficulty 5/5 Over a week Newbie friendliness 42/100
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
objectionary/eo#8869 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
EricSpencer00/Resilient#4824 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
objectionary/jeo-maven-plugin#1758 ·
-
generics
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
mlir
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
llvm/llvm-project#224908 · 1 comment ·