avfilter/vsrc_testsrc: rgbtestsrc: fix undefined behaviour

Fixes #8238
pull/323/head
Paul B Mahol 5 years ago
parent 64a805883d
commit b20dee813a
  1. 6
      libavfilter/vsrc_testsrc.c

@ -968,10 +968,10 @@ AVFILTER_DEFINE_CLASS(rgbtestsrc);
#define A 3
static void rgbtest_put_pixel(uint8_t *dst, int dst_linesize,
int x, int y, int r, int g, int b, enum AVPixelFormat fmt,
int x, int y, unsigned r, unsigned g, unsigned b, enum AVPixelFormat fmt,
uint8_t rgba_map[4])
{
int32_t v;
uint32_t v;
uint8_t *p;
switch (fmt) {
@ -991,7 +991,7 @@ static void rgbtest_put_pixel(uint8_t *dst, int dst_linesize,
case AV_PIX_FMT_BGRA:
case AV_PIX_FMT_ARGB:
case AV_PIX_FMT_ABGR:
v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8)) + (255 << (rgba_map[A]*8));
v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8)) + (255U << (rgba_map[A]*8));
p = dst + 4*x + y*dst_linesize;
AV_WL32(p, v);
break;

Loading…
Cancel
Save