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

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

Protect against malformed header size

M  +1    -1    lib/mobipocket.cpp

https://invent.kde.org/graphics/kdegraphics-mobipocket/-/commit/46cae2d51539bc307dd0b102fd27372ebc0365d5

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.