Fix condition order to prevent out of range array accesses, which may

lead to a segfault when unhighlighting two matching parentheses.

Fix by Markus <desterium@t-online.de>.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@38050 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2014-08-25 21:20:32 +00:00
parent 82979d58d8
commit e617310415
2 changed files with 12 additions and 2 deletions

View file

@ -1,3 +1,13 @@
2014-08-25 Wolfgang Lux <wolfgang.lux@gmail.com>
* Modules/Editors/ProjectCenter/PCEditor.m (unhighlightCharacter:):
* Modules/Editors/ProjectCenter/PCEditor.m
(highlightCharacterAt:inEditor:):
Fix condition order to prevent out of range array accesses, which
may lead to a segfault when unhighlighting two matching parentheses.
Fix by Markus <desterium@t-online.de>.
2014-08-18 16:07-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Modules/Projects/Aggregate/Resources/Inspector.gorm

View file

@ -1228,7 +1228,7 @@ NSUInteger FindDelimiterInString(NSString * string,
[textStorage beginEditing];
// if (isCharacterHighlit)
for (i = 0; (highlited_chars[i] != -1 && i < 2); i++)
for (i = 0; i < 2 && highlited_chars[i] != -1; i++)
{
NSRange r = NSMakeRange(highlited_chars[i], 1);
// NSRange r = NSMakeRange(highlitCharacterLocation, i);
@ -1282,7 +1282,7 @@ NSUInteger FindDelimiterInString(NSString * string,
{
int i;
for (i = 0; highlited_chars[i] != -1; i++) {};
for (i = 0; i < 2 && highlited_chars[i] != -1; i++) {};
// if (isCharacterHighlit == NO)
if (i < 2)