From 1f23533b682b9015400d2dc32f12af01f2551855 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 10 Feb 2020 17:11:46 +0000 Subject: [PATCH] Fix error in opj_memory_stream_skip --- src/grib_openjpeg_encoding.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/grib_openjpeg_encoding.c b/src/grib_openjpeg_encoding.c index 3503b9ce8..ecee220e9 100644 --- a/src/grib_openjpeg_encoding.c +++ b/src/grib_openjpeg_encoding.c @@ -280,9 +280,9 @@ static OPJ_OFF_T opj_memory_stream_skip(OPJ_OFF_T nb_bytes, void* user_data) l_nb_bytes = (OPJ_SIZE_T)nb_bytes; /* Allowed because it is positive */ /* Do not allow jumping past the end */ if (l_nb_bytes > mstream->dataSize - mstream->offset) - nb_bytes = mstream->dataSize - mstream->offset; - mstream->offset += l_nb_bytes; - return l_nb_bytes; /* Returm how far we jumped */ + l_nb_bytes = mstream->dataSize - mstream->offset; /* Jump the max. */ + mstream->offset += l_nb_bytes; /* Make the jump */ + return l_nb_bytes; /* Return how far we jumped */ } /* Sets the pointer to anywhere in the memory */