feat(anki): robust zstd decode via a retry-doubling buffer #765
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
project-halkyon/halkyon-learn!765
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/765/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes the known limitation from #764: a modern collection compressing
better than ~8x overflowed zstd_dart's fixed srcSize*8 output buffer and
fell back to re-export guidance. Anki's frames carry no stored
content-size, so the output can't be pre-sized; instead we reuse
zstd_dart's low-level FFI bindings and retry ZSTD_decompress with a
doubling buffer (up to a 1 GiB ceiling) until the frame fits — so any
compression ratio decodes.
(ZSTD_getFrameContentSize error sentinel); only the "destination buffer
too small" case grows the buffer.
the grow loop (27 bytes -> 200 000 zero bytes), corrupt, and empty.