-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The returned value from ZSTD_getFrameContentSize is not checked. #46
Comments
Thanks for pointing this out. Not sure when I'll be able to implement a fix. Happy to accept a PR. |
I have a few ideas about how to fix this. How do you do exception handling? |
Could we use |
Minimal reproducer:
|
Bonus byte sequence to test:
It should decompress to |
awesome, thanks for taking a stab at this!
Looks reasonable to me, but this disclaimer is interesting:
I'm curious what the overhead refers to (i.e, size of bundle or runtime cost)? It seems there is some native wasm exceptions as an option as well, but I'm not sure how widely supported they are across runtimes (browsers probably our main target) |
The return value of
ZSTD_getFrameContentSize
is not checked before being passed tomalloc
.numcodecs.js/codecs/zstd/zstd_codec.cpp
Lines 28 to 29 in b9a8ca9
Here is the relevant excerpt from the Zstd manual as of version 1.5.1
The return value from
ZSTD_getFrameContentSize
could be eitherZSTD_CONTENTSIZE_UNKNOWN
orZSTD_CONTENTSIZE_ERROR
. Preferably the value should be bounded by the expected destination buffer size rather than letting this be unconstrained from the data.xref: google/neuroglancer#625
The text was updated successfully, but these errors were encountered: