[FFmpeg-devel] [PATCH 1/7] avcodec/ffv1dec: add missing error messages when a frame is invalid

Michael Niedermayer michael at niedermayer.cc
Sat Mar 10 01:30:21 EET 2018


On Thu, Mar 08, 2018 at 02:48:19AM +0100, Jerome Martinez wrote:
> On 08/03/2018 01:17, Michael Niedermayer wrote:
> >
> >In the cases where the error is about a scalar value, that value should
> >be printed in the error message (unless it was alread printed elsewhere)
> 
> Patch modified, showing the scalar value.

>  ffv1dec.c |   39 +++++++++++++++++++++++++++++++--------
>  1 file changed, 31 insertions(+), 8 deletions(-)
> b91dc1d7d73ea648cb343b5c3ed8159dc9bcc015  0001-avcodec-ffv1dec-add-missing-error-messages-when-a-fr.patch
> From 13db9fc4da1d0e531e516bd87d084233e231f0e7 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Martinez?= <jerome at mediaarea.net>
> Date: Thu, 8 Mar 2018 02:40:21 +0100
> Subject: [PATCH] avcodec/ffv1dec: add missing error messages when a frame is
>  invalid
> 
> ---
>  libavcodec/ffv1dec.c | 39 +++++++++++++++++++++++++++++++--------
>  1 file changed, 31 insertions(+), 8 deletions(-)
> 
> diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
> index 3d2ee2569f..06509dae60 100644
> --- a/libavcodec/ffv1dec.c
> +++ b/libavcodec/ffv1dec.c
> @@ -182,11 +182,22 @@ static int decode_slice_header(FFV1Context *f, FFV1Context *fs)
>      fs->slice_y /= f->num_v_slices;
>      fs->slice_width  = fs->slice_width /f->num_h_slices - fs->slice_x;
>      fs->slice_height = fs->slice_height/f->num_v_slices - fs->slice_y;
> -    if ((unsigned)fs->slice_width > f->width || (unsigned)fs->slice_height > f->height)
> +    if ((unsigned)fs->slice_width > f->width) {
> +        av_log(f->avctx, AV_LOG_ERROR, "slice_width %d out of range\n", (unsigned)fs->slice_width);
>          return -1;
> -    if (    (unsigned)fs->slice_x + (uint64_t)fs->slice_width  > f->width
> -         || (unsigned)fs->slice_y + (uint64_t)fs->slice_height > f->height)
> +    }
> +    if ((unsigned)fs->slice_height > f->height) {
> +        av_log(f->avctx, AV_LOG_ERROR, "slice_height %d out of range\n", (unsigned)fs->slice_height);
> +        return -1;
> +    }
> +    if ((unsigned)fs->slice_x + (uint64_t)fs->slice_width  > f->width) {
> +        av_log(f->avctx, AV_LOG_ERROR, "slice_x+slice_width %lld out of range\n", (unsigned)fs->slice_x + (uint64_t)fs->slice_width, (unsigned)fs->slice_y);

%lld is incorrect for uint64_t
PRIu64 or PRId64 or something liek that is matching it

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is what and why we do it that matters, not just one of them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180310/0fdee4cb/attachment.sig>


More information about the ffmpeg-devel mailing list