X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fvf_paletteuse.c;h=1980907e70ecaf40c208831a6e8ef7fc815d1858;hb=cfd52094c027a3e31ee6ea9aafeb4a2e3c152ec1;hp=ed80ab04d5e9eaddf16a2cfecbcedc6e3e2c4226;hpb=0525722ca03aa6c3c8d828ad278e1870731bfafc;p=ffmpeg diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c index ed80ab04d5e..1980907e70e 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);