From a9b36b4ec44bd31b5fd184a1ff5c17b8e7b4c84f Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 9 May 2022 15:44:47 +0100 Subject: [PATCH] Simple packing: corner case of bpv>0 for a constant field --- src/grib_accessor_class_data_simple_packing.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/grib_accessor_class_data_simple_packing.c b/src/grib_accessor_class_data_simple_packing.c index 0c36c26c5..5811451ae 100644 --- a/src/grib_accessor_class_data_simple_packing.c +++ b/src/grib_accessor_class_data_simple_packing.c @@ -400,6 +400,15 @@ static int _unpack_double(grib_accessor* a, double* val, size_t* len, unsigned c return GRIB_DECODING_ERROR; } } +#if 0 + if (offsetBeforeData == offsetAfterData) { + /* Crazy case: Constant field with bitsPerValue > 0 */ + for (i = 0; i < n_vals; i++) + val[i] = reference_value; + *len = n_vals; + return GRIB_SUCCESS; + } +#endif } grib_context_log(a->context, GRIB_LOG_DEBUG,