https://bugs.kde.org/show_bug.cgi?id=520200

Thomas Monjalon <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
      Latest Commit|                            |https://invent.kde.org/fram
                   |                            |eworks/kcodecs/-/commit/eaa
                   |                            |dbbf13095b4fc75b9e76e7c4b30
                   |                            |e2d1e1ff70

--- Comment #2 from Thomas Monjalon <[email protected]> ---
Git commit eaadbbf13095b4fc75b9e76e7c4b30e2d1e1ff70 by Thomas Monjalon.
Committed on 15/05/2026 at 14:29.
Pushed by cullmann into branch 'master'.

[Codec] Fix infinite loop in charset lookup

cachedCharset(QByteArrayView) uses qstricmp(name.data(), charset.data())
to look up charsets in the cache.
QByteArrayView::data() is not null-terminated,
so when parsing RFC 2047 encoded-words like =?us-ascii?Q?...?=,
qstricmp compares beyond the charset name into the encoded data.
The comparison always fails, causing the cache to grow without bound
with duplicate entries and the linear search to degrade to O(n²).

This manifests as 100% CPU and high memory usage in KMail
when processing emails with multiple consecutive encoded-words
(e.g. SendGrid X-SG-EID/X-SG-ID tracking headers).

Replace qstricmp with QByteArrayView::compare()
which correctly respects the view's length.

M  +6    -0    autotests/rfc2047test.cpp
M  +1    -1    src/kcodecs.cpp

https://invent.kde.org/frameworks/kcodecs/-/commit/eaadbbf13095b4fc75b9e76e7c4b30e2d1e1ff70

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to