Repository navigation
Bound the canonical text, not only the input, by max_bytes - #59
Conversation
Signed-off-by: Srishti <rathisrishti@gmail.com>
|
Claude finished @SrishtiCode's task in 2m 22s —— View job Claude reviewPR summary. Key changes reviewed
Areas reviewed
Areas skipped
Findings
Residual risks
Claude review: no actionable issues found.
|
zy4
left a comment
There was a problem hiding this comment.
Checked canonical_len against write_value and write_string, including the 2- and 6-byte escapes; the property test ties them together. Approving.
Port of the fix from dekrops/counterplay#2, the first correctness fix under the verified-cli freeze (dekrops/counterplay#5). Limits::max_bytes is documented to bound both input and canonical output, but parse() only checked the input and the exponent expansion separately, so [1e9] with max_bytes 10 was accepted although its canonical text is 12 bytes, and raw C1 and DEL characters grow when escaped. parse() now measures the exact canonical length (new Value::canonical_len(), computed without writing the text) and refuses anything over max_bytes. Adds regression tests for the exponent, C1, object-key and DEL cases, and a property test that canonical_len() equals the length of to_canonical_string(). All workspace tests pass, including the wvp corpus (641 cases). Resource limits may be tuned under the compatibility policy, so this is not a breaking change.