[frameworks/kimageformats] autotests/ossfuzz: ossfuzz: call functions used in animations

Daniel Novomeský <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit c57af25d3615219d47d997667f41efaae7cc611c by Daniel Novomeský.
Committed on 10/08/2026 at 17:46.
Pushed by novomeskyd into branch 'master'.

ossfuzz: call functions used in animations

M  +21   -1    autotests/ossfuzz/kimgio_fuzzer.cc

https://invent.kde.org/frameworks/kimageformats/-/commit/c57af25d3615219d47d997667f41efaae7cc611c

diff --git a/autotests/ossfuzz/kimgio_fuzzer.cc b/autotests/ossfuzz/kimgio_fuzzer.cc
index e3ae96f7..5992533f 100644
--- a/autotests/ossfuzz/kimgio_fuzzer.cc
+++ b/autotests/ossfuzz/kimgio_fuzzer.cc
@@ -125,7 +125,27 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
     b.open(QIODevice::ReadOnly);
     handler->setDevice(&b);
     handler->canRead();
-    handler->read(&i);
+
+    bool is_animated = false;
+    if (handler->supportsOption(QImageIOHandler::Animation)) {
+        is_animated = handler->option(QImageIOHandler::Animation).toBool();
+    }
+
+    if (is_animated) { // animated image
+        if (handler->supportsOption(QImageIOHandler::Size)) {
+            handler->option(QImageIOHandler::Size).toSize();
+        }
+
+        handler->imageCount();
+        handler->loopCount();
+        handler->read(&i);
+        handler->nextImageDelay();
+        handler->currentImageNumber();
+        handler->jumpToImage(0);
+        handler->jumpToNextImage();
+    } else { // static image
+        handler->read(&i);
+    }
 
     delete handler;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.