Skip to content

Commit

Permalink
#105: test: fix out-of-bounds access
Browse files Browse the repository at this point in the history
Found with `-fsanitize=bounds`.

Resolves #105.
  • Loading branch information
jkrems authored and aklomp committed Oct 13, 2022
1 parent 9ae5ad3 commit 4a87aba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/test_base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ test_streaming (int flags)
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;
}
}
if (enclen != 256) {
printf("FAIL: stream decoding gave incorrect size: "
Expand Down

0 comments on commit 4a87aba

Please sign in to comment.