Skip to content

Commit cba709a

Browse files
jkremsaklomp
authored andcommitted
#105: test: fix out-of-bounds access
Found with clang's `-fsanitize=bounds'. Resolves #105.
1 parent 9ae5ad3 commit cba709a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/test_base64.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ test_streaming (int flags)
198198
while (base64_stream_decode(&state, &ref[inpos], (inpos + bs > reflen) ? reflen - inpos : bs, &enc[enclen], &partlen)) {
199199
enclen += partlen;
200200
inpos += bs;
201+
202+
// Has the entire buffer been consumed?
203+
if (inpos >= 400) {
204+
break;
205+
}
201206
}
202207
if (enclen != 256) {
203208
printf("FAIL: stream decoding gave incorrect size: "

0 commit comments

Comments
 (0)