]> granicus.if.org Git - graphviz/commitdiff
Avoid infinite loop if spurious arrow name is given
authorEmden R. Gansner <erg@research.att.com>
Tue, 10 Sep 2013 15:24:16 +0000 (11:24 -0400)
committerEmden R. Gansner <erg@research.att.com>
Tue, 10 Sep 2013 15:24:16 +0000 (11:24 -0400)
lib/common/arrows.c

index fa374048b54ffd48099155bad4c88b0623a80f4b..7e6edd97af1a9aac04b3535ee20a480e92f3451c 100644 (file)
@@ -173,12 +173,18 @@ static char *arrow_match_shape(char *name, int *flag)
 static void arrow_match_name(char *name, int *flag)
 {
     char *rest = name;
+    char *next;
     int i, f;
 
     *flag = 0;
     for (i = 0; *rest != '\0' && i < NUMB_OF_ARROW_HEADS; ) {
        f = ARR_TYPE_NONE;
-        rest = arrow_match_shape(rest, &f);
+       next = rest;
+        rest = arrow_match_shape(next, &f);
+       if (f == ARR_TYPE_NONE) {
+           agerr(AGWARN, "Arrow type \"%s\" unknown - ignoring\n", next);
+           return;
+       }
        if (f == ARR_TYPE_GAP && i == (NUMB_OF_ARROW_HEADS -1))
            f = ARR_TYPE_NONE;
        if (f != ARR_TYPE_NONE)