Crash: Trying to print expandedOriginalCodes with bufr_ls
@@ -571,6 +571,13 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
if (err)
return 0;
+ if (*len < self->tableCodesSize) {
+ grib_context_log(a->context, GRIB_LOG_ERROR,
+ " wrong size (%ld) for %s it contains %d values ", *len, a->name, self->tableCodesSize);
+ *len = 0;
+ return GRIB_ARRAY_TOO_SMALL;
+ }
+
for (i = 0; i < self->tableCodesSize; i++)
val[i] = self->tableCodes[i];
