[FFmpeg-devel] [PATCH 1/9] lavfi/paletteuse: check get_color return value

Clément Bœsch u at pkh.me
Thu Nov 9 20:13:24 EET 2017


On Wed, Nov 08, 2017 at 07:17:45PM +0100, Timo Rothenpieler wrote:
> Fixes CID #1420396
> ---
>  libavfilter/vf_paletteuse.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
> index ed80ab04d5..1980907e70 100644
> --- a/libavfilter/vf_paletteuse.c
> +++ b/libavfilter/vf_paletteuse.c
> @@ -380,8 +380,11 @@ static av_always_inline int get_dst_color_err(PaletteUseContext *s,
>      const uint8_t r = c >> 16 & 0xff;
>      const uint8_t g = c >>  8 & 0xff;
>      const uint8_t b = c       & 0xff;
> +    uint32_t dstc;
>      const int dstx = color_get(s, c, a, r, g, b, search_method);
> -    const uint32_t dstc = s->palette[dstx];
> +    if (dstx < 0)
> +        return dstx;
> +    dstc = s->palette[dstx];
>      *er = r - (dstc >> 16 & 0xff);
>      *eg = g - (dstc >>  8 & 0xff);
>      *eb = b - (dstc       & 0xff);

should be fine

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171109/8552ce6b/attachment.sig>


More information about the ffmpeg-devel mailing list