Fix undefined behavior found by GCC 5
GCC said: qtldurl.cpp:51:50: error: loop exit may only be reached after undefined behavior [-Werror=aggressive-loop-optimizations] qtldurl.cpp:51:48: note: possible undefined statement is here while (tldIndices[index] >= tldChunks[chunk] && chunk < tldChunkCount) { ^ That's because we check whether chunk is still valid (less than tldChunkCount) after we've dereferenced tldChunks[chunk]. That is, we've already read tldChunk[2]. Change-Id: I79b6a1ea9a2454813d6cce7596fc2bb6d972d097 Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
26b0ff7bad
commit
cd407e1bc6
@ -48,7 +48,7 @@ static bool containsTLDEntry(const QString &entry)
|
||||
// select the right chunk from the big table
|
||||
short chunk = 0;
|
||||
uint chunkIndex = tldIndices[index], offset = 0;
|
||||
while (tldIndices[index] >= tldChunks[chunk] && chunk < tldChunkCount) {
|
||||
while (chunk < tldChunkCount && tldIndices[index] >= tldChunks[chunk]) {
|
||||
chunkIndex -= tldChunks[chunk];
|
||||
offset += tldChunks[chunk];
|
||||
chunk++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user