-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit 8d18f60.
- Loading branch information
Showing
8 changed files
with
67 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "zip.h" | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
int LLVMFuzzerTestOneInput(const uint8_t *data, const size_t size) | ||
{ | ||
char *outbuf = NULL; | ||
size_t outbufsize = 0; | ||
|
||
struct zip_t *zip = zip_stream_open(NULL, 0, ZIP_DEFAULT_COMPRESSION_LEVEL, 'w'); | ||
|
||
zip_entry_open(zip, "test"); | ||
zip_entry_write(zip, data, size); | ||
zip_entry_close(zip); | ||
zip_stream_copy(zip, (void **) &outbuf, &outbufsize); | ||
zip_stream_close(zip); | ||
free(outbuf); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "zip.h" | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
int LLVMFuzzerTestOneInput(const uint8_t *data, const size_t size) | ||
{ | ||
void *buf = NULL; | ||
size_t bufsize = 0; | ||
|
||
struct zip_t *zip = zip_stream_open((const char *)data, size, 0, 'r'); | ||
if (NULL == zip) | ||
{ | ||
goto end; | ||
} | ||
|
||
const ssize_t zip_entries_count = zip_entries_total(zip); | ||
|
||
if (zip_entries_count <= 0) | ||
{ | ||
goto end; | ||
} | ||
|
||
if (0 != zip_entry_openbyindex(zip, 0)) | ||
{ | ||
goto end; | ||
} | ||
|
||
zip_entry_read(zip, &buf, &bufsize); | ||
|
||
end: | ||
zip_entry_close(zip); | ||
if (NULL != zip) | ||
{ | ||
zip_close(zip); | ||
} | ||
free(buf); | ||
return 0; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.