-
Notifications
You must be signed in to change notification settings - Fork 35
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
Buffer overflow when encoding (detected by address sanitizer) #21
Comments
Thank you for reporting this issue. I fixed this bug at the commit a14390c. |
@sile Since you fixed this bug, should we close this issue? I am not sure if older versions of the crate should be patched as well? |
By the way, A better approach would be to subslice the input Even this one bounds check per function can often be eliminated if the bounds are checked up front before calling this function in a tight loop, or by using iterators. |
@DevQps I will close this issue. Thank you for your suggestion.
If users of the older versions are using encoding functionality, I think it is better to upgrade |
@Shnatsel Thank you for your advice. If the modification you suggested does not cause a drop in performance, I would like to adopt it. I will try the idea when I have a time for implementing and benchmarking it (of course, PR is very welcome). |
Repro steps:
Expected to finish without any messages. However, got an ASAN error instead.
The relevant function contains unchecked read, which is totally unsafe (there is no guarantee that
buf.len() >= 3
; in this issue thebuf.len() == 2
).libflate/src/lz77/default.rs
Lines 108 to 117 in 74c2b8b
A longer, equivalent version:
The text was updated successfully, but these errors were encountered: