Skip to content

Commit

Permalink
zlib: improve coverage of gzio_fuzzer (#13028)
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-sans-paille authored Feb 12, 2025
1 parent 599eecc commit 2772bd6
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion projects/zlib/gzio_fuzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataLen) {
*/
int op_count = 2; //< Number of operations chained.
while(op_count--) {
switch((--dataLen, (*data)%12)) {
switch((--dataLen, (*data)%19)) {
case 0: {
char c = dataLen ? (--dataLen, (char)*data++) : 'c';
if(gzputc(file, c) < 0) {
Expand Down Expand Up @@ -153,6 +153,37 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataLen) {
};
break;
}
case 12: {
gzoffset(file);
break;
}
case 13: {
gzrewind(file);
break;
}
case 14: {
gzeof(file);
break;
}
case 15: {
gzdirect(file);
break;
}
case 16: {
unsigned sz = dataLen ? ((--dataLen, *data++))|1 : 128;
if(gzbuffer(file, sz) <0)
goto exit;
break;
}
case 17: {
int errnum;
gzerror(file, &errnum);
break;
}
case 18: {
gzclearerr(file);
break;
}
}
}
gzclose(file);
Expand Down

0 comments on commit 2772bd6

Please sign in to comment.