From: Kenneth Graunke Date: Fri, 19 May 2017 22:25:21 +0000 (-0700) Subject: genxml: Fix decoder for groups with multiple fields. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d1b949282f6387e9dc4a9a43defc8aaa08749c0a;p=mesa.git genxml: Fix decoder for groups with multiple fields. If you have something like: We would reset ctx->group_count to 0 after processing the first field, so the second would not have a group count. This is largely untested, as the only groups with multiple fields are packets we don't emit in Mesa. Found by inspection. Acked-by: Lionel Landwerlin --- diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c index 3ea2eaf8dbf..de50c4466bc 100644 --- a/src/intel/common/gen_decoder.c +++ b/src/intel/common/gen_decoder.c @@ -414,11 +414,9 @@ start_element(void *data, const char *element_name, const char **atts) &ctx->group->group_count, &ctx->group->elem_size, &ctx->group->variable); } else if (strcmp(element_name, "field") == 0) { - do { + for (int g = 0; g < MAX2(ctx->group->group_count, 1); g++) { ctx->fields[ctx->nfields++] = create_field(ctx, atts); - if (ctx->group->group_count) - ctx->group->group_count--; - } while (ctx->group->group_count > 0); + } } else if (strcmp(element_name, "enum") == 0) { ctx->enoom = create_enum(ctx, name, atts); } else if (strcmp(element_name, "value") == 0) {