From 372f119dcb6fecdf928c78d2dc240a3e9d4b336b Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 4 Jul 2013 15:27:50 +0100 Subject: [PATCH] GRIB-292: fix bug with checking num bytes when EOF reached --- fortran/grib_f90_tail.f90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fortran/grib_f90_tail.f90 b/fortran/grib_f90_tail.f90 index 88a3b18a2..61e4564ac 100644 --- a/fortran/grib_f90_tail.f90 +++ b/fortran/grib_f90_tail.f90 @@ -757,7 +757,7 @@ ibytes=nbytes iret=grib_f_read_any_from_file(ifile,buffer,ibytes) - if (ibytes > huge(nbytes)) then + if (iret == GRIB_SUCCESS .and. ibytes > huge(nbytes)) then iret = GRIB_MESSAGE_TOO_LARGE endif nbytes=ibytes @@ -817,7 +817,7 @@ ibytes=nbytes iret=grib_f_read_any_from_file(ifile,buffer,ibytes) - if (ibytes > huge(nbytes)) then + if (iret == GRIB_SUCCESS .and. ibytes > huge(nbytes)) then iret = GRIB_MESSAGE_TOO_LARGE endif nbytes=ibytes @@ -877,7 +877,7 @@ ibytes=nbytes iret=grib_f_read_any_from_file(ifile,buffer,ibytes) - if (ibytes > huge(nbytes)) then + if (iret == GRIB_SUCCESS .and. ibytes > huge(nbytes)) then iret = GRIB_MESSAGE_TOO_LARGE endif nbytes=ibytes @@ -937,7 +937,7 @@ ibytes=nbytes iret=grib_f_read_any_from_file(ifile,buffer,ibytes) - if (ibytes > huge(nbytes)) then + if (iret == GRIB_SUCCESS .and. ibytes > huge(nbytes)) then iret = GRIB_MESSAGE_TOO_LARGE endif nbytes=ibytes @@ -2699,7 +2699,7 @@ integer(kind=kindOfSize_t) :: ibytes iret = grib_f_get_message_size ( gribid, ibytes ) - if (ibytes > huge(nbytes)) then + if (iret == GRIB_SUCCESS .and. ibytes > huge(nbytes)) then iret = GRIB_MESSAGE_TOO_LARGE endif nbytes = ibytes