The generated RootBuilder crashed (undefined behavior on std::vector::back()) when a JSON document's root value was a scalar or null while the schema declared a non-nullable object or array root. The stack starts empty for object/array roots, but cbStringData, cbNumberData, and cbBool called stack_.back() without checking for an empty stack.
Add an empty-stack guard to the three scalar callbacks so they reject instead of crashing. cbNull already handles the empty-stack case correctly.
Regression tests added for:
non-nullable object root rejecting null, true, 123, and "hi" roots
nullable object root rejecting scalar roots
nullable array root rejecting scalar roots
Closes #16
The generated `RootBuilder` crashed (undefined behavior on `std::vector::back()`) when a JSON document's root value was a scalar or `null` while the schema declared a non-nullable object or array root. The stack starts empty for object/array roots, but `cbStringData`, `cbNumberData`, and `cbBool` called `stack_.back()` without checking for an empty stack.
Add an empty-stack guard to the three scalar callbacks so they reject instead of crashing. `cbNull` already handles the empty-stack case correctly.
Regression tests added for:
- non-nullable object root rejecting `null`, `true`, `123`, and `"hi"` roots
- nullable object root rejecting scalar roots
- nullable array root rejecting scalar roots
The generated RootBuilder crashed (undefined behavior on std::vector::back())
when a JSON document's root value was a scalar or null while the schema
declared a non-nullable object or array root. The stack starts empty for
object/array roots, but cbStringData, cbNumberData, and cbBool called
stack_.back() without checking for an empty stack.
Add an empty-stack guard to the three scalar callbacks so they reject
instead of crashing. cbNull already handles the empty-stack case.
Regression tests added for:
- non-nullable object root rejecting null, boolean, number, and string roots
- nullable object root rejecting scalar roots
- nullable array root rejecting scalar roots
Closes#16
andrew
merged commit 4ce2002663 into main2026-06-24 19:34:07 +00:00
andrew
deleted branch weaselbot/issue-162026-06-24 19:34:07 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #16
The generated
RootBuildercrashed (undefined behavior onstd::vector::back()) when a JSON document's root value was a scalar ornullwhile the schema declared a non-nullable object or array root. The stack starts empty for object/array roots, butcbStringData,cbNumberData, andcbBoolcalledstack_.back()without checking for an empty stack.Add an empty-stack guard to the three scalar callbacks so they reject instead of crashing.
cbNullalready handles the empty-stack case correctly.Regression tests added for:
null,true,123, and"hi"roots