From 7874d76141a2f6ed080d340141dd6840c1e5c1c9 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Sat, 25 Jul 2020 15:02:42 +0100 Subject: [PATCH] ECC-1138: CRASH: bufr_dump -p on invalid file --- src/grib_accessor_class.c | 1 + src/grib_accessor_class_bufr_data_array.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/grib_accessor_class.c b/src/grib_accessor_class.c index 7b470f217..d00fb0d95 100644 --- a/src/grib_accessor_class.c +++ b/src/grib_accessor_class.c @@ -248,6 +248,7 @@ void grib_push_accessor(grib_accessor* a, grib_block_of_accessors* l) l->last = a; if (hand->use_trie) { + DebugAssert( a->all_names[0] ); if (*(a->all_names[0]) != '_') { id = grib_hash_keys_get_id(a->context->keys, a->all_names[0]); diff --git a/src/grib_accessor_class_bufr_data_array.c b/src/grib_accessor_class_bufr_data_array.c index 51c4217c4..397824613 100644 --- a/src/grib_accessor_class_bufr_data_array.c +++ b/src/grib_accessor_class_bufr_data_array.c @@ -2641,6 +2641,9 @@ static int create_keys(grib_accessor* a, long onlySubset, long startSubset, long err = GRIB_DECODING_ERROR; return err; } + if (elementAccessor->name == NULL) { + return GRIB_DECODING_ERROR; + } /*if (associatedFieldAccessor) grib_accessor_delete(c, associatedFieldAccessor);*/ associatedFieldAccessor = NULL;