Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5 use-of-uninitialized-memory bugs while testing fuzzing harnesses #464

Open
skorpion98 opened this issue Sep 13, 2024 · 0 comments
Open

Comments

@skorpion98
Copy link

skorpion98 commented Sep 13, 2024

Summary

We found several use-of-uninitialized-memory issues while testing the encoder_heic_fuzzer fuzzing harness for ImageMagick. Upon further inspection, these issues seem to be related to an external dependency (libde265) rather than to ImageMagick itself. For this reason, we decided to report them directly here, instead of reporting them to ImageMagick. It is still possible that these errors are caused by an incorrect use of libde265; if you believe this is the case, we will report them to ImageMagick as well.

We found bugs in the following functions:

  1. use-of-uninitialized value in function put_weighted_pred_avg_16_fallback() <libde265/fallback-motion.cc>
  2. use-of-uninitialized value in function put_weighted_bipred_16_fallback() <libde265/fallback-motion.cc>
  3. use-of-uninitialized value in function put_weighted_pred_16_fallback() <libde265/fallback-motion.cc>
  4. conditional jump or move depends on uninitialized value in function derive_collocated_motion_vectors() <libde265/motion.cc>
  5. use-of-uninitialized value in function add_residual_fallback<unsigned short>() <libde265/fallback-dct.h>

Steps to reproduce

In the following archive you will find a directory bugs containing the several inputs that triggered the aforementioned bugs and their respective Valgrind log, enumerated as the list above. Additionally, you will find at this link the compiled fuzzing harness we used to perform our tests (we had to share it from outside github as its size exceeds the size limit for this issue).

To reproduce the errors, a memory safety tool is required to expose the bug. Run the given binary with the testcase files inside Valgrind with a command like valgrind ./encoder_heic_fuzzer /path_to_testcases/input

The program has been tested on the standard Docker image provided on OSS-Fuzz using Ubuntu 20.04, providing AFL++ as fuzzing engine and build flag --sanitizer=none.

The libde265 hash commit used to perform the tests is 0a9999e, the latest at the time of testing.
The ImageMagick hash commit used to perform the tests is 6299383.

Environment

  • OS: Linux
  • Version/Distribution: Ubuntu 20.04
  • Architecture: x86_64

We are aware that reporting many bugs at once may be inconvenient, and we remain available to assist you in the bug fixing process. While our knowledge of the codebase is very limited and thus prevents us from directly working on the fixes, we would be happy to provide any helpful information related to our experience with testing for memory-safety errors and to re-test the project as you work on the updates. In general, we’re happy to answer any questions on fuzz testing, sanitizers, and related matters that may help you make the project more secure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant