-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix out-of-bounds access in test #105
Conversation
Thanks for the PR. Looks like a real issue, an out-of-bounds pointer is being dereferenced. Your fix works, and will bail out the loop before the dereference happens. The following code might make the intent a bit clearer: while (base64_stream_decode(&state, &ref[inpos], (inpos + bs > reflen) ? reflen - inpos : bs, &enc[enclen], &partlen)) {
enclen += partlen;
inpos += bs;
// Has the entire buffer been consumed?
if (inpos >= 400) {
break;
}
} But no need to change it. As a side note, I'd be interested in running |
Updated to use the suggested pattern. More precisely, this was found via
That is, it will print an error though exit code is still 0. I didn't dig more deeply than that. :) |
Thanks for the update, I'll merge it shortly. Also thanks for posting the code to reproduce the warning. I've added it to my own build script. |
Merged after rebasing. |
Found with `-fsanitize=bounds`. Resolves #105.
Sorry for reopening and reclosing, I forgot to annotate the commit with |
When running the tests with address sanitizer enabled, it fails with the following error:
I think adding this bounds check preserves the semantics of the test but I'm not super familiar with the codebase.