Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Cope with indicator arrays that do not have the correct length.
authorMichael Meskes <meskes@postgresql.org>
Sat, 13 Jan 2018 13:56:49 +0000 (14:56 +0100)
committerMichael Meskes <meskes@postgresql.org>
Mon, 15 Jan 2018 09:02:16 +0000 (10:02 +0100)
Patch by: "Rader, David" <davidr@openscg.com>

src/interfaces/ecpg/preproc/type.c

index 6c2645965eebd92c8bc6a66d133a3a83d5f5245c..9d59167750d534d5bdcbb25d33d982dc2f2ce9d8 100644 (file)
@@ -609,7 +609,17 @@ ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsiz,
                        prefix, ind_prefix, arrsiz, type->struct_sizeof,
                        (ind_p != NULL) ? ind_type->struct_sizeof : NULL);
        if (ind_p != NULL && ind_p != &struct_no_indicator)
+       {
            ind_p = ind_p->next;
+           if (ind_p == NULL && p->next != NULL) {
+               mmerror(PARSE_ERROR, ET_WARNING, "indicator struct \"%s\" has too few members", ind_name);
+               ind_p = &struct_no_indicator;
+           }
+       }
+   }
+
+   if (ind_type != NULL && ind_p != NULL && ind_p != &struct_no_indicator) {
+       mmerror(PARSE_ERROR, ET_WARNING, "indicator struct \"%s\" has too many members", ind_name);
    }
 
    free(pbuf);