Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: do not parse base62 strings of unexpected length
Reject parsing base62 strings that would result in unexpectedly long payloads and potentially large allocations. Without this, it is possible to use a base62 string to pass in extra bytes of data that are unused (but do consume memory for a time). I don't know if this is something people rely on, but it seems unlikely that anyone would find this desirable. This might represent a possible way to OOM any code accepting KSUIDs that didn't limit incoming payload sizes already, but there are probably better options for that. Add a test for both long and short base62 strings to try to skip allocating anything for strings of the wrong length by decoding them. Previously, length checks only happened after decoding and would only take the tail end of the decoded base62 string.
- Loading branch information