diff --git a/src/grib_accessor_class_data_ccsds_packing.c b/src/grib_accessor_class_data_ccsds_packing.c index b952c8e11..c10079085 100644 --- a/src/grib_accessor_class_data_ccsds_packing.c +++ b/src/grib_accessor_class_data_ccsds_packing.c @@ -214,7 +214,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) grib_handle* hand = grib_handle_of_accessor(a); int err = GRIB_SUCCESS, i = 0; - size_t buflen = grib_byte_count(a); + size_t buflen = 0; struct aec_stream strm; double bscale = 0; double dscale = 0; @@ -260,9 +260,6 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) if ((err = grib_get_long_internal(hand, self->ccsds_rsi, &ccsds_rsi)) != GRIB_SUCCESS) return err; - bscale = grib_power(binary_scale_factor, 2); - dscale = grib_power(-decimal_scale_factor, 10); - /* TODO: This should be called upstream */ if (*len < n_vals) return GRIB_ARRAY_TOO_SMALL; @@ -275,6 +272,10 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return GRIB_SUCCESS; } + bscale = grib_power(binary_scale_factor, 2); + dscale = grib_power(-decimal_scale_factor, 10); + + buflen = grib_byte_count(a); buf = (unsigned char*)hand->buffer->data; buf += grib_byte_offset(a); diff --git a/tests/include.ctest.sh.in b/tests/include.ctest.sh.in index 2f313212b..2330af454 100644 --- a/tests/include.ctest.sh.in +++ b/tests/include.ctest.sh.in @@ -1,6 +1,24 @@ set -ea # For CMake +# Unset any environment variable that could interfere with tests +unset ECCODES_EXTRA_DEFINITION_PATH +unset ECCODES_LOG_STREAM +unset ECCODES_FAIL_IF_LOG_MESSAGE +unset ECCODES_DEBUG +unset ECCODES_GRIB_WRITE_ON_FAIL +unset ECCODES_GRIB_DATA_QUALITY_CHECKS +unset ECCODES_GRIB_KEEP_MATRIX +unset ECCODES_GRIB_NO_SPD +unset ECCODES_GRIB_NO_BIG_GROUP_SPLIT +unset ECCODES_GRIB_IEEE_PACKING +unset ECCODES_GRIBEX_MODE_ON +unset ECCODES_BUFRDC_MODE_ON +unset ECCODES_BUFR_SET_TO_MISSING_IF_OUT_OF_RANGE +unset ECCODES_BUFR_MULTI_ELEMENT_CONSTANT_ARRAYS +unset ECCODES_FILE_POOL_MAX_OPENED_FILES +unset ECCODES_IO_BUFFER_SIZE + set -x echo "Script: $0"