mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
oss-fuzz: Add fuzzing targets for simplified READ API
New target added to libpng_read_fuzzer.cc for simplified READ API.
This commit is contained in:
parent
0e204b7364
commit
68ba4f1f7d
@ -204,5 +204,21 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|||||||
png_read_end(png_handler.png_ptr, png_handler.end_info_ptr);
|
png_read_end(png_handler.png_ptr, png_handler.end_info_ptr);
|
||||||
|
|
||||||
PNG_CLEANUP
|
PNG_CLEANUP
|
||||||
|
|
||||||
|
#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
|
||||||
|
// Simplified READ API
|
||||||
|
png_image image;
|
||||||
|
memset(&image, 0, (sizeof image));
|
||||||
|
image.version = PNG_IMAGE_VERSION;
|
||||||
|
|
||||||
|
if (!png_image_begin_read_from_memory(&image, data, size)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
image.format = PNG_FORMAT_RGBA;
|
||||||
|
std::vector<png_byte> buffer(PNG_IMAGE_SIZE(image));
|
||||||
|
png_image_finish_read(&image, NULL, buffer.data(), 0, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user