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

Add fuzzing dictionary and test all printStructure() options #1804

Merged
merged 2 commits into from
Jul 28, 2021

Conversation

kevinbackhouse
Copy link
Collaborator

Two changes to the fuzzer to make it more comprehensive:

  1. Added more calls to printStructure using all the available options, such as kpsXMP and kpsRecursive.
  2. Added a dictionary, which helps to improve fuzzing performance.

The dictionary is checked in as a text file, but I have also included the scripts that I used to generate it, with a README explaining how to run them. The dictionary isn't very big, and doesn't need to be updated very often, so it's much more convenient to add it to the repo.

@codecov
Copy link

codecov bot commented Jul 27, 2021

Codecov Report

Merging #1804 (db1529a) into main (c486999) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1804   +/-   ##
=======================================
  Coverage   67.86%   67.86%           
=======================================
  Files         151      151           
  Lines       20847    20844    -3     
=======================================
- Hits        14147    14146    -1     
+ Misses       6700     6698    -2     
Impacted Files Coverage Δ
src/image.cpp 72.68% <ø> (-0.07%) ⬇️
src/jpgimage.cpp 86.62% <ø> (+0.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c486999...db1529a. Read the comment docs.

@@ -27,6 +27,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size) {
// produce lots of garbage on stdout.
std::ostringstream buffer;
image->printStructure(buffer, Exiv2::kpsNone);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 24, seems to not do anything. exifData() just returns a reference to the container holding the exif metadata.

Do you think it would be helpful to the printing of the actual metadata values here as well?
That would cover all the functions we use to convert various raw metadata into their respective string representation.

Unfortunately, this isn't directly implemented in the image class, but in printMetadata() in actions.cpp.
But we could implement something similar relatively easily here since we don't need to worry about options and could just print every single metadatum we find.

Copy link
Collaborator Author

@kevinbackhouse kevinbackhouse Jul 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. It was in the original version of this fuzzer and I kept it because I didn't realize that it doesn't do anything. I have removed it now.

@kevinbackhouse kevinbackhouse merged commit 2488fc8 into Exiv2:main Jul 28, 2021
@kevinbackhouse kevinbackhouse added this to the v1.00 milestone Sep 2, 2021
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

Successfully merging this pull request may close these issues.

2 participants