Repository navigation
Conversation
contrib/oss-fuzz/build.sh has disabled the WRITE and STDIO options in pnglibconf.dfa since 2017, so the libpng16.a the fuzzers link has no write support and no stdio functions, unlike the libpng that distributions ship (where both are enabled). pngwrite.c, pngwutil.c, pngwtran.c and pngwio.c, and the stdio functions (png_init_io, png_image_begin_read_from_file/_stdio, png_image_write_to_file/_stdio), are therefore not compiled in the OSS-Fuzz build. Stop disabling STDIO and WRITE. With STDIO enabled, CONSOLE_IO would be enabled too and libpng's default error and warning handlers would print every message to stderr, so disable CONSOLE_IO instead: the existing read fuzzers stay as quiet as before. This is needed for fuzzers of the write side.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
contrib/oss-fuzz/build.sh has disabled the WRITE and STDIO options in pnglibconf.dfa since 2017. The libpng16.a that the OSS-Fuzz fuzzers link therefore contains no write support and no stdio functions, while the libpng that distributions ship has both. pngwrite.c, pngwutil.c, pngwtran.c, pngwio.c and the stdio entry points (png_init_io, png_image_begin_read_from_file/_stdio, png_image_write_to_file/_stdio) are not compiled in the fuzz build at all.
This change stops disabling WRITE and STDIO. Enabling STDIO would also enable CONSOLE_IO, with which libpng's default error and warning handlers print every message to stderr, so CONSOLE_IO is disabled instead: the four existing fuzzers are unchanged and stay as quiet as before. It is the prerequisite for fuzzing the write side (a follow-up PR will add a write fuzzer; the progressive reader is the subject of #946).
Effect, measured by comparing the source lines present in the debug line tables of the shipped library with the lines compiled by the OSS-Fuzz ASan build (the four console-output lines of png_default_error and png_default_warning, which this build no longer compiles, counted as not compiled):
Cost: no new dependencies; libpng16.a becomes larger (write objects are linked into the existing fuzzers because png.c references them); build time unchanged within noise.
Sanitizers: address, undefined and memory builds pass helper.py check_build; the change adds no dependency.