Skip to content

Add fuzz target for previews (backport #3505)#3507

Merged
kmilos merged 1 commit into0.28.xfrom
mergify/bp/0.28.x/pr-3505
Feb 23, 2026
Merged

Add fuzz target for previews (backport #3505)#3507
kmilos merged 1 commit into0.28.xfrom
mergify/bp/0.28.x/pr-3505

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented Feb 23, 2026

This fuzz target mimics this code:

exiv2/app/actions.cpp

Lines 584 to 616 in 45c8b18

int Print::printPreviewList() {
if (!Exiv2::fileExists(path_)) {
std::cerr << path_ << ": " << _("Failed to open the file") << "\n";
return -1;
}
auto image = Exiv2::ImageFactory::open(path_);
image->readMetadata();
bool const manyFiles = Params::instance().files_.size() > 1;
int cnt = 0;
Exiv2::PreviewManager pm(*image);
std::ostringstream os;
std::ios::fmtflags f(os.flags());
Exiv2::PreviewPropertiesList list = pm.getPreviewProperties();
for (const auto& pos : list) {
if (manyFiles)
os << std::setfill(' ') << std::left << std::setw(20) << path_ << " ";
os << _("Preview") << " " << ++cnt << ": " << pos.mimeType_ << ", ";
if (pos.width_ != 0 && pos.height_ != 0)
os << pos.width_ << "x" << pos.height_ << " " << _("pixels") << ", ";
os << pos.size_ << " " << _("bytes") << "\n";
}
binaryOutput(os);
os.flags(f);
return 0;
} // Print::printPreviewList
Task::UniquePtr Print::clone() const {
return std::make_unique<Print>(*this);
}

I'll add it to OSS-Fuzz once it's merged.


This is an automatic backport of pull request #3505 done by Mergify.

@mergify mergify Bot added the conflicts label Feb 23, 2026
@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented Feb 23, 2026

Cherry-pick of d114ebb has failed:

On branch mergify/bp/0.28.x/pr-3505
Your branch is up to date with 'origin/0.28.x'.

You are currently cherry-picking commit d114ebbb.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   fuzz/fuzz-preview.cpp

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   fuzz/CMakeLists.txt

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify Bot mentioned this pull request Feb 23, 2026
@kmilos kmilos added this to the v0.28.8 milestone Feb 23, 2026
@kmilos kmilos force-pushed the mergify/bp/0.28.x/pr-3505 branch from 809f138 to aa35699 Compare February 23, 2026 14:54
@kmilos kmilos removed the conflicts label Feb 23, 2026
(cherry picked from commit d114ebb)

# Conflicts:
#	fuzz/CMakeLists.txt
@kmilos kmilos force-pushed the mergify/bp/0.28.x/pr-3505 branch from aa35699 to 64c202b Compare February 23, 2026 15:24
@kmilos kmilos merged commit 6da8c7b into 0.28.x Feb 23, 2026
106 of 114 checks passed
@mergify mergify Bot deleted the mergify/bp/0.28.x/pr-3505 branch February 23, 2026 16:36
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