Message ID | 1321608503-56938-1-git-send-email-martin@martin.st |
---|---|
State | Committed |
Commit | b55aa7df6b79746541f05d65c414961f49f46f68 |
Headers | show |
On Fri, Nov 18, 2011 at 11:28:19AM +0200, Martin Storsjö wrote: > From: Michael Niedermayer <michaelni@gmx.at> > > Signed-off-by: Michael Niedermayer <michaelni@gmx.at> > --- > libavcodec/cinepak.c | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c > index f8b5352..0dbdeab 100644 > --- a/libavcodec/cinepak.c > +++ b/libavcodec/cinepak.c > @@ -330,6 +330,10 @@ static int cinepak_decode (CinepakContext *s) > > /* if this is the first frame, check for deviant Sega FILM data */ > if (s->sega_film_skip_bytes == -1) { > + if (!encoded_buf_size) { > + av_log_ask_for_sample(s->avctx, "encoded_buf_size is 0"); > + return -1; > + } > if (encoded_buf_size != s->size && (s->size % encoded_buf_size) != 0) { > /* If the encoded frame size differs from the frame size as indicated > * by the container file, this data likely comes from a Sega FILM/CPK file. > -- looks OK
On 18/11/11 10:32, Kostya Shishkov wrote: > On Fri, Nov 18, 2011 at 11:28:19AM +0200, Martin Storsjö wrote: >> From: Michael Niedermayer <michaelni@gmx.at> >> >> Signed-off-by: Michael Niedermayer <michaelni@gmx.at> >> --- >> libavcodec/cinepak.c | 4 ++++ >> 1 files changed, 4 insertions(+), 0 deletions(-) >> >> diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c >> index f8b5352..0dbdeab 100644 >> --- a/libavcodec/cinepak.c >> +++ b/libavcodec/cinepak.c >> @@ -330,6 +330,10 @@ static int cinepak_decode (CinepakContext *s) >> >> /* if this is the first frame, check for deviant Sega FILM data */ >> if (s->sega_film_skip_bytes == -1) { >> + if (!encoded_buf_size) { >> + av_log_ask_for_sample(s->avctx, "encoded_buf_size is 0"); >> + return -1; >> + } >> if (encoded_buf_size != s->size && (s->size % encoded_buf_size) != 0) { >> /* If the encoded frame size differs from the frame size as indicated >> * by the container file, this data likely comes from a Sega FILM/CPK file. >> -- > Don't we have an AVERROR specific?
On Fri, 18 Nov 2011, Luca Barbato wrote: > On 18/11/11 10:32, Kostya Shishkov wrote: >> On Fri, Nov 18, 2011 at 11:28:19AM +0200, Martin Storsjö wrote: >>> From: Michael Niedermayer <michaelni@gmx.at> >>> >>> Signed-off-by: Michael Niedermayer <michaelni@gmx.at> >>> --- >>> libavcodec/cinepak.c | 4 ++++ >>> 1 files changed, 4 insertions(+), 0 deletions(-) >>> >>> diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c >>> index f8b5352..0dbdeab 100644 >>> --- a/libavcodec/cinepak.c >>> +++ b/libavcodec/cinepak.c >>> @@ -330,6 +330,10 @@ static int cinepak_decode (CinepakContext *s) >>> >>> /* if this is the first frame, check for deviant Sega FILM data */ >>> if (s->sega_film_skip_bytes == -1) { >>> + if (!encoded_buf_size) { >>> + av_log_ask_for_sample(s->avctx, "encoded_buf_size is 0"); >>> + return -1; >>> + } >>> if (encoded_buf_size != s->size && (s->size % encoded_buf_size) != 0) { >>> /* If the encoded frame size differs from the frame size as indicated >>> * by the container file, this data likely comes from a Sega FILM/CPK file. >>> -- >> > > Don't we have an AVERROR specific? Only AVERROR_PATCHWELCOME which is a different case. A better generic option of course could be used, but the file itself is filled with "return -1", so there's more to do if you want to clean it up :-) // Martin
diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index f8b5352..0dbdeab 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -330,6 +330,10 @@ static int cinepak_decode (CinepakContext *s) /* if this is the first frame, check for deviant Sega FILM data */ if (s->sega_film_skip_bytes == -1) { + if (!encoded_buf_size) { + av_log_ask_for_sample(s->avctx, "encoded_buf_size is 0"); + return -1; + } if (encoded_buf_size != s->size && (s->size % encoded_buf_size) != 0) { /* If the encoded frame size differs from the frame size as indicated * by the container file, this data likely comes from a Sega FILM/CPK file.