mirror of https://github.com/ecmwf/eccodes.git
ECC-1605: Fix lower bound
This commit is contained in:
parent
9cbeff4549
commit
8169b17ca8
|
@ -228,7 +228,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
|
||||||
} else {
|
} else {
|
||||||
// ECC-1605: Check overflow/underflow
|
// ECC-1605: Check overflow/underflow
|
||||||
const int nbits = self->nbytes * 8;
|
const int nbits = self->nbytes * 8;
|
||||||
const long minval = -(1L << (nbits-1));
|
const long minval = -(1L << (nbits-1)) + 1;
|
||||||
const long maxval = (1L << (nbits-1)) - 1;
|
const long maxval = (1L << (nbits-1)) - 1;
|
||||||
//printf(" key=%s: v=%ld (minval=%ld maxval=%ld)\n", a->name, v, minval, maxval);
|
//printf(" key=%s: v=%ld (minval=%ld maxval=%ld)\n", a->name, v, minval, maxval);
|
||||||
if (v > maxval || v < minval) {
|
if (v > maxval || v < minval) {
|
||||||
|
|
|
@ -84,7 +84,7 @@ if [ $ECCODES_ON_WINDOWS -eq 0 ]; then
|
||||||
status=$?
|
status=$?
|
||||||
set -e
|
set -e
|
||||||
[ $status -ne 0 ]
|
[ $status -ne 0 ]
|
||||||
grep -q "Trying to encode value of 2147483648 but the allowable range is -2147483648 to 2147483647" $temp
|
grep -q "Trying to encode value of 2147483648 but the allowable range is -2147483647 to 2147483647" $temp
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
${tools_dir}/grib_set -s forecastTime=-2147483650 $input $outfile 2>$temp
|
${tools_dir}/grib_set -s forecastTime=-2147483650 $input $outfile 2>$temp
|
||||||
|
|
Loading…
Reference in New Issue