Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Fri, 01 Aug 2014 14:05:09 UTC
Commit: 257de6597cd7fb0f7cd75d20c67c0de1d85d491a
https://github.com/geany/geany/commit/257de6597cd7fb0f7cd75d20c67c0de1d85d4…
Log Message:
-----------
fortran: Make sure not to index kinds out of bounds
This also makes recent GCC shut up about indexing below the bounds as
it detected the code checked for a negative index yet didn't guard the
actual access. For now GCC doesn't understand the more comprehensive
check, but it might come back if GCC becomes smart enough.
Anyway, this makes the Assert() more correct, and addition of the
explicit kinds array size makes sure any future kind addition won't
miss its entry.
Modified Paths:
--------------
tagmanager/ctags/fortran.c
Modified: tagmanager/ctags/fortran.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -214,7 +214,7 @@ static boolean NewLine = TRUE;
static unsigned int contextual_fake_count = 0;
/* indexed by tagType */
-static kindOption FortranKinds [] = {
+static kindOption FortranKinds [TAG_COUNT] = {
{ TRUE, 'b', "block data", "block data"},
{ TRUE, 'c', "macro", "common blocks"},
{ TRUE, 'e', "entry", "entry points"},
@@ -490,7 +490,7 @@ static boolean isFileScope (const tagType type)
static boolean includeTag (const tagType type)
{
boolean include;
- Assert (type != TAG_UNDEFINED);
+ Assert (type > TAG_UNDEFINED && type < TAG_COUNT);
include = FortranKinds [(int) type].enabled;
if (include && isFileScope (type))
include = Option.include.fileScope;
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).