avfilter/vsrc_testsrc: rgbtestsrc: fix undefined behaviour

Fixes #8238
This commit is contained in:
Paul B Mahol 2019-10-16 12:31:40 +02:00
parent 64a805883d
commit b20dee813a
1 changed files with 3 additions and 3 deletions

View File

@ -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;