fix containsTLDEntry crash when there are three or more chunks
authorDmitry Shachnev <mitya57@debian.org>
Sat, 8 Feb 2025 16:24:33 +0000 (19:24 +0300)
committerDmitry Shachnev <mitya57@debian.org>
Sat, 8 Feb 2025 16:24:33 +0000 (19:24 +0300)
Forwarded: no
Bug-Debian: https://bugs.debian.org/1095423
Last-Update: 2025-02-08

tldChunks[N] contains total size of chunks from 0 to N, not just the Nth one.

Gbp-Pq: Name containsTLDEntry.diff

src/corelib/io/qtldurl.cpp

index 7a4ab36c57ad0fa9adbf31d1c18e27dc778e98c2..085490408c0c0f61c655c05f5807684b25980d5e 100644 (file)
@@ -86,8 +86,8 @@ static bool containsTLDEntry(QStringView entry, TLDMatchType match)
 
     // Find which chunk contains the tldGroupOffset
     while (tldGroupOffset >= tldChunks[chunk]) {
-        chunkIndex -= tldChunks[chunk];
-        offset += tldChunks[chunk];
+        chunkIndex = tldIndices[index] - tldChunks[chunk];
+        offset = tldChunks[chunk];
         chunk++;
 
         // We can not go above the number of chunks we have, since all our