diff --git a/src/bufr_util.c b/src/bufr_util.c index 8fdb6bada..8211d9b41 100644 --- a/src/bufr_util.c +++ b/src/bufr_util.c @@ -539,6 +539,7 @@ static int bufr_decode_header(grib_context* c, const void* message, off_t offset hdr->message_size = (unsigned long)size; err = bufr_extract_edition(message, &hdr->edition); + if (err) return err; if (hdr->edition == 3) { err = bufr_decode_edition3(message, hdr); diff --git a/src/grib_accessor_class_data_2order_packing.c b/src/grib_accessor_class_data_2order_packing.c index 5d10fc9ef..8c0e6bf28 100644 --- a/src/grib_accessor_class_data_2order_packing.c +++ b/src/grib_accessor_class_data_2order_packing.c @@ -472,7 +472,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) grib_accessor* abitmap = NULL; size_t bitmap_len = 0; - err = grib_value_count(a, &nn); + err = grib_value_count(a, &nn); + if (err) return err; n_vals = nn; if ((err = grib_get_long_internal(gh, self->offsetsection, &offsetsection)) != GRIB_SUCCESS)