-
Notifications
You must be signed in to change notification settings - Fork 158
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
Unchecked mallocs in parallel.c #41
Comments
Bitstream.c also contains unchecked mallocs for the stream_open and stream_clone functions. If this malloc fails, stream_open/clone returns NULL. In parallel.c, stream_open is called repeatedly (l.55) without verifying if the return value is not NULL. This causes crashes upon memory access or freeing. In order to fix this the mallocs have to be checked. On failed malloc, would it be best to return an error in bitstream.c or to check for NULL returns in the caller? |
Thanks for letting us know. Really the only mallocs in bitstream.c are for the small, 40-byte bitstream struct, and the mallocs themselves are checked. The calling code should check for NULL return values from If this malloc fails, you probably have larger problems to worry about, so having a dedicated error code for such a rare occurrence does not make much sense to me. You can't really take any reasonable action in this case other than abort. We'll add fixes to check the return values. |
The missing |
The function compress_init_par in the file parallel.c contains the following unchecked mallocs
zfp/src/share/parallel.c
Line 51 in 25a554e
zfp/src/share/parallel.c
Line 54 in 25a554e
I uploaded a fix in #40
The text was updated successfully, but these errors were encountered: