diff --git a/src/grib_accessor_class_bufr_data_array.c b/src/grib_accessor_class_bufr_data_array.c index 1058bb88e..ad1c8c1d1 100644 --- a/src/grib_accessor_class_bufr_data_array.c +++ b/src/grib_accessor_class_bufr_data_array.c @@ -1381,7 +1381,7 @@ static int encode_new_replication(grib_context* c, grib_accessor_bufr_data_array int err = 0; unsigned long repetitions = 1; bufr_descriptor** descriptors = self->expanded->v; - /* Assert( buff->data==data); */ + DebugAssert( buff->data == data ); switch (descriptors[i]->code) { case 31000: @@ -1425,6 +1425,7 @@ static int encode_new_replication(grib_context* c, grib_accessor_bufr_data_array grib_context_log(c, GRIB_LOG_DEBUG, "BUFR data encoding replication: \twidth=%ld pos=%ld ulength=%ld ulength_bits=%ld", (long)descriptors[i]->width, (long)*pos, (long)buff->ulength, (long)buff->ulength_bits); grib_buffer_set_ulength_bits(c, buff, buff->ulength_bits + descriptors[i]->width); + data = buff->data; /* ECC-1347 */ grib_encode_unsigned_longb(data, repetitions, pos, descriptors[i]->width); *numberOfRepetitions = repetitions; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d0287c0c7..638046659 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -99,6 +99,7 @@ if( HAVE_BUILD_TOOLS ) bufr_ecc-1259 bufr_ecc-1290 bufr_ecc-1304 + bufr_ecc-1347 bufr_json_samples bufr_ecc-359 bufr_ecc-517 diff --git a/tests/bufr_ecc-1347.sh b/tests/bufr_ecc-1347.sh new file mode 100755 index 000000000..1cc2e7830 --- /dev/null +++ b/tests/bufr_ecc-1347.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + +. ./include.sh + +set -u + +label="bufr_ecc-1347-test" +tempBufr=temp.$label.bufr +tempFilt=temp.$label.filter + +sample_bufr3=$ECCODES_SAMPLES_PATH/BUFR3.tmpl + +cat > $tempFilt <