diff --git a/src/accessor/grib_accessor_class_expanded_descriptors.cc b/src/accessor/grib_accessor_class_expanded_descriptors.cc index f2a406089..d70a29c9c 100644 --- a/src/accessor/grib_accessor_class_expanded_descriptors.cc +++ b/src/accessor/grib_accessor_class_expanded_descriptors.cc @@ -181,7 +181,7 @@ void grib_accessor_expanded_descriptors_t::__expand(bufr_descriptors_array* unex /* Number of descriptors to replicate cannot be more than what's left */ if (us->X + 1 > unexpanded->n) { grib_context_log(c, GRIB_LOG_ERROR, - "Delayed replication: %06ld: expected %d but only found %lu elements", + "Delayed replication: %06ld: expected %d but only found %lu element(s)", u->code, us->X, unexpanded->n - 1); *err = GRIB_DECODING_ERROR; return; @@ -232,6 +232,10 @@ void grib_accessor_expanded_descriptors_t::__expand(bufr_descriptors_array* unex grib_bufr_descriptor_delete(u); size = us->X * us->Y; memset(ur, 0, us->X); /* ECC-1422 */ + if (us->X > unexpanded->n) { + grib_context_log(c, GRIB_LOG_ERROR, "Replication descriptor %06ld: expected %d but only found %zu element(s)", + us->code, us->X, unexpanded->n); + } for (j = 0; j < us->X; j++) { DESCRIPTORS_POP_FRONT_OR_RETURN(unexpanded, ur[j]); #if MYDEBUG diff --git a/tests/bufr_ecc-1028.sh b/tests/bufr_ecc-1028.sh index 36016648a..f759f7fe5 100755 --- a/tests/bufr_ecc-1028.sh +++ b/tests/bufr_ecc-1028.sh @@ -24,7 +24,7 @@ status=$? set -e [ $status -ne 0 ] # Check error message -grep -q "Delayed replication: 101000: expected 1 but only found 0 elements" $tempError +grep -q "Delayed replication: 101000: expected 1 but only found 0 element(s)" $tempError rm -f $tempFilt $tempError