[graphics/kdegraphics-mobipocket/release/26.08] lib: Protect against malformed header size

Albert Astals Cid <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 204022265447bfb738b488a05ef24860379062d7 by Albert Astals Cid.
Committed on 31/07/2026 at 11:09.
Pushed by aacid into branch 'release/26.08'.

Protect against malformed header size

(cherry picked from commit 46cae2d51539bc307dd0b102fd27372ebc0365d5)

M  +1    -1    lib/mobipocket.cpp

https://invent.kde.org/graphics/kdegraphics-mobipocket/-/commit/204022265447bfb738b488a05ef24860379062d7

diff --git a/lib/mobipocket.cpp b/lib/mobipocket.cpp
index 6dbba8c..7901411 100644
--- a/lib/mobipocket.cpp
+++ b/lib/mobipocket.cpp
@@ -78,7 +78,7 @@ namespace
     const QVector<QByteArray> getHuffRecords(const PDB &pdb)
     {
         const QByteArray header = pdb.getRecord(0);
-        if (header[1] != 'H') {
+        if (header.size() < 0x78 || header[1] != 'H') {
             return {};
         }
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.