From 9abd5dc1346764bcc563c8de0d4f24ff622bf9f9 Mon Sep 17 00:00:00 2001 From: Ray Winkelman Date: Mon, 28 Sep 2026 16:15:22 +0700 Subject: [PATCH 1/2] Fix std.parseJson/parseYaml abort on number overflow Catch json::exception (not only parse_error) so out_of_range.406 from overflowing numbers becomes a RuntimeError instead of aborting via libjsonnet's CATCH. Fixes #1337 --- core/vm.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/vm.cpp b/core/vm.cpp index 667f9e1c..9c7f80e1 100644 --- a/core/vm.cpp +++ b/core/vm.cpp @@ -1702,7 +1702,9 @@ class Interpreter { bool filled; otherJsonToHeap(j, filled, scratch); - } catch (const json::parse_error &e) { + } catch (const json::exception &e) { + // parse_error and out_of_range (e.g. 1E999) must become RuntimeError, + // not escape to libjsonnet's CATCH and abort. See #1337. throw makeError(loc, e.what()); } @@ -1737,6 +1739,10 @@ class Interpreter { } } catch (const RapidYamlError& exc) { throw makeError(loc, exc.msg_); + } catch (const json::exception &e) { + // RapidYAML may emit JSON text that json::parse rejects with + // out_of_range (number overflow), not only parse_error. See #1337. + throw makeError(loc, e.what()); } bool filled_unused; otherJsonToHeap(j, filled_unused, scratch); From bf6c02316de3786155e5ccd14e4149526dae6c25 Mon Sep 17 00:00:00 2001 From: Ray Winkelman Date: Mon, 28 Sep 2026 17:31:22 +0700 Subject: [PATCH 2/2] chore: retrigger Google CLA check