From b1b789df4203296a848fec6a3513f30efceb1a45 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 6 Feb 2024 15:30:29 -0500 Subject: Detect end of input inside an unfinished JSON string --- libtests/json.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libtests') diff --git a/libtests/json.cc b/libtests/json.cc index e84ef0a0..4f4cff8e 100644 --- a/libtests/json.cc +++ b/libtests/json.cc @@ -134,6 +134,12 @@ test_main() " \"normal\": \"string\"\n" "}"); + try { + JSON::parse("\""); + assert(false); + } catch (std::runtime_error&) { + } + // Check default constructed JSON object (order as per JSON.hh). JSON uninitialized; std::string ws; -- cgit v1.2.3-70-g09d2