[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-cvs
Subject:    [LyX/master] Do not read array before checking the bounds
From:       Jean-Marc Lasgouttes <lasgouttes () lyx ! org>
Date:       2015-02-20 15:52:21
Message-ID: 20150220155221.850A32807EF () lyx ! lyx ! org
[Download RAW message or body]

commit 143c136a7fb3641f15ba2f152c98558db6b5e989
Author: Jean-Marc Lasgouttes <lasgouttes@lyx.org>
Date:   Fri Feb 20 16:51:20 2015 +0100

    Do not read array before checking the bounds
    
    Fixes coverity issue 23377

diff --git a/src/frontends/qt4/GuiSymbols.cpp b/src/frontends/qt4/GuiSymbols.cpp
index 1e7e789..6ccecf5 100644
--- a/src/frontends/qt4/GuiSymbols.cpp
+++ b/src/frontends/qt4/GuiSymbols.cpp
@@ -176,7 +176,7 @@ QString getBlock(char_type c)
 
 	// guessing was wrong so far. do a real search.
 	int i = 0;
-	while (c > unicode_blocks[i].end && i < no_blocks)
+	while (i < no_blocks && c > unicode_blocks[i].end)
 		++i;
 	if (i == no_blocks)
 		return QString();

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic