From: Ben Pfaff Date: Sat, 9 Jan 2021 06:17:30 +0000 (-0800) Subject: spv-legacy-decoder: Initialize all members for SPV_VALUE_TEXT. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82eefd6de0852d5ec93771fb06786cdc8fd8ed6f;p=pspp spv-legacy-decoder: Initialize all members for SPV_VALUE_TEXT. These were supposed to always be nonnull but this code didn't do it properly. --- diff --git a/src/output/pivot-table.h b/src/output/pivot-table.h index e7537e781b..85aef6ab3c 100644 --- a/src/output/pivot-table.h +++ b/src/output/pivot-table.h @@ -688,6 +688,8 @@ struct pivot_value /* PIVOT_VALUE_TEXT. */ struct { + /* 'local', 'c', and 'id' must all be nonnull, but they are allowed + to be the same pointer. */ char *local; /* Localized. */ char *c; /* English. */ char *id; /* Identifier. */ @@ -698,6 +700,8 @@ struct pivot_value /* PIVOT_VALUE_TEMPLATE. */ struct { + /* Both 'local' and 'id' must be nonnull, but they are allowed to + be the same pointer. */ char *local; /* Localized. */ char *id; /* Identifier. */ struct pivot_argument *args; diff --git a/src/output/spv/spv-legacy-decoder.c b/src/output/spv/spv-legacy-decoder.c index 78b1780b17..0b224405b7 100644 --- a/src/output/spv/spv-legacy-decoder.c +++ b/src/output/spv/spv-legacy-decoder.c @@ -720,6 +720,9 @@ decode_label_frame (struct pivot_table *table, value->text.local = new; } } + if (!value->text.local) + value->text.local = xstrdup (""); + value->text.c = value->text.id = value->text.local; pivot_value_destroy (*target); *target = value; }