diff mbox series

[FFmpeg-devel] libavcodec/jpeg2000dec.c: Fix cblk decode error check

Message ID 20200401071346.20416-1-gautamramk@gmail.com
State New
Headers show
Series [FFmpeg-devel] libavcodec/jpeg2000dec.c: Fix cblk decode error check | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Gautam Ramakrishnan April 1, 2020, 7:13 a.m. UTC
From: Gautam Ramakrishnan <gautamramk@gmail.com>

bpno becoming negative is not an error. This check has
been verified with openjpeg, where the loop ends safely
when bpno becomes negative, instead of returning an error.
This patch must resolve ticket #5630.
---
 libavcodec/jpeg2000dec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Paul B Mahol April 1, 2020, 12:18 p.m. UTC | #1
LGTM

On 4/1/20, gautamramk@gmail.com <gautamramk@gmail.com> wrote:
> From: Gautam Ramakrishnan <gautamramk@gmail.com>
>
> bpno becoming negative is not an error. This check has
> been verified with openjpeg, where the loop ends safely
> when bpno becomes negative, instead of returning an error.
> This patch must resolve ticket #5630.
> ---
>  libavcodec/jpeg2000dec.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> index 7103cd6ceb..c5711b60ec 100644
> --- a/libavcodec/jpeg2000dec.c
> +++ b/libavcodec/jpeg2000dec.c
> @@ -1562,8 +1562,7 @@ static int decode_cblk(Jpeg2000DecoderContext *s,
> Jpeg2000CodingStyle *codsty,
>
>      while (passno--) {
>          if (bpno < 0) {
> -            av_log(s->avctx, AV_LOG_ERROR, "bpno became negative\n");
> -            return AVERROR_INVALIDDATA;
> +            break;
>          }
>          switch(pass_t) {
>          case 0:
> --
> 2.17.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Gautam Ramakrishnan April 10, 2020, 5:41 p.m. UTC | #2
On Wed, Apr 1, 2020 at 5:48 PM Paul B Mahol <onemda@gmail.com> wrote:
>
> LGTM
>
> On 4/1/20, gautamramk@gmail.com <gautamramk@gmail.com> wrote:
> > From: Gautam Ramakrishnan <gautamramk@gmail.com>
> >
> > bpno becoming negative is not an error. This check has
> > been verified with openjpeg, where the loop ends safely
> > when bpno becomes negative, instead of returning an error.
> > This patch must resolve ticket #5630.
> > ---
> >  libavcodec/jpeg2000dec.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> > index 7103cd6ceb..c5711b60ec 100644
> > --- a/libavcodec/jpeg2000dec.c
> > +++ b/libavcodec/jpeg2000dec.c
> > @@ -1562,8 +1562,7 @@ static int decode_cblk(Jpeg2000DecoderContext *s,
> > Jpeg2000CodingStyle *codsty,
> >
> >      while (passno--) {
> >          if (bpno < 0) {
> > -            av_log(s->avctx, AV_LOG_ERROR, "bpno became negative\n");
> > -            return AVERROR_INVALIDDATA;
> > +            break;
> >          }
> >          switch(pass_t) {
> >          case 0:
> > --
> > 2.17.1
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Hi,

There were a lot of other changes to jpeg2000dec.c
after this was sent. Do I resubmit this patch?
Carl Eugen Hoyos April 10, 2020, 8:56 p.m. UTC | #3
Am Fr., 10. Apr. 2020 um 19:48 Uhr schrieb Gautam Ramakrishnan
<gautamramk@gmail.com>:
>
> On Wed, Apr 1, 2020 at 5:48 PM Paul B Mahol <onemda@gmail.com> wrote:
> >
> > LGTM
> >
> > On 4/1/20, gautamramk@gmail.com <gautamramk@gmail.com> wrote:
> > > From: Gautam Ramakrishnan <gautamramk@gmail.com>
> > >
> > > bpno becoming negative is not an error. This check has
> > > been verified with openjpeg, where the loop ends safely
> > > when bpno becomes negative, instead of returning an error.
> > > This patch must resolve ticket #5630.
> > > ---
> > >  libavcodec/jpeg2000dec.c | 3 +--
> > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > >
> > > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> > > index 7103cd6ceb..c5711b60ec 100644
> > > --- a/libavcodec/jpeg2000dec.c
> > > +++ b/libavcodec/jpeg2000dec.c
> > > @@ -1562,8 +1562,7 @@ static int decode_cblk(Jpeg2000DecoderContext *s,
> > > Jpeg2000CodingStyle *codsty,
> > >
> > >      while (passno--) {
> > >          if (bpno < 0) {
> > > -            av_log(s->avctx, AV_LOG_ERROR, "bpno became negative\n");
> > > -            return AVERROR_INVALIDDATA;
> > > +            break;
> > >          }
> > >          switch(pass_t) {
> > >          case 0:
> > > --
> > > 2.17.1

> There were a lot of other changes to jpeg2000dec.c
> after this was sent. Do I resubmit this patch?

Yes, please do.

Carl Eugen
diff mbox series

Patch

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 7103cd6ceb..c5711b60ec 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1562,8 +1562,7 @@  static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,
 
     while (passno--) {
         if (bpno < 0) {
-            av_log(s->avctx, AV_LOG_ERROR, "bpno became negative\n");
-            return AVERROR_INVALIDDATA;
+            break;
         }
         switch(pass_t) {
         case 0: