Commit Graph
5 Commits
Author SHA1 Message Date
Jils Shah 3e208ae2b6 Reject data after padding in @base64d (#3732)
The `@base64d` decoder stopped at the first `=` and ignored the rest of
the input, so "YWJjZA==ZWZn" decoded to "abcd" without an error.

Raise the existing "is not valid base64 data" error when anything other
than `=` follows the first `=`. This also rejects whitespace after the
padding, so "YQ==\n" no longer decodes to "a", consistent with how
whitespace is rejected elsewhere in the input. Padded and unpadded input
decodes as before.
2026-12-06 14:47:11 +09:00
itchyny 22361cfb87 Improve error message truncation with closing delimiters (#3478)
Truncated strings now show closing delimiters: `..."` for strings,
`...]` for arrays, and `...}` for objects, making error messages
clearer.
2026-02-25 08:14:23 +09:00
itchyny 94fd973ebb Fix calloc error on @base64d format (ref #3280) (#3286)
This commit fixes a regression of a8ce2ff, e.g. `"=" | @base64d`.
2025-03-06 04:30:46 +09:00
itchyny a8ce2ff09a Avoid zero-length calloc (#3280)
Using `calloc` function with a count of zero elements is implementation
defined and it may cause allocation errors on some platforms (ref #3277).
This commit fixes `jv_mem_calloc` callers to avoid undefined behavior.
2025-03-04 22:33:51 +09:00
Shaun Guth e0b784ac6d Add @base64d for decoding base64 #47 2017-02-12 16:03:59 -05:00