History

avfilter/vsrc_testsrc: rgbtestsrc: fix undefined behaviour

Fixes #8238

Paul B Mahol committed 7 years ago

Commit b20dee81 parent 64a80581 file · +3 −3Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vsrc_testsrc.c+3−3
@@ -968,10 +968,10 @@ AVFILTER_DEFINE_CLASS(rgbtestsrc); · 967 unmodified lines
968#define A 3968#define A 3
969 969
970static void rgbtest_put_pixel(uint8_t *dst, int dst_linesize,970static void rgbtest_put_pixel(uint8_t *dst, int dst_linesize,
971 int x, int y, int r, int g, int b, enum AVPixelFormat fmt,971 int x, int y, unsigned r, unsigned g, unsigned b, enum AVPixelFormat fmt,
972 uint8_t rgba_map[4])972 uint8_t rgba_map[4])
973{973{
974 int32_t v;974 uint32_t v;
975 uint8_t *p;975 uint8_t *p;
976 976
977 switch (fmt) {977 switch (fmt) {
@@ -991,7 +991,7 @@ static void rgbtest_put_pixel(uint8_t *dst, int dst_linesize, · 13 unmodified lines
991 case AV_PIX_FMT_BGRA:991 case AV_PIX_FMT_BGRA:
992 case AV_PIX_FMT_ARGB:992 case AV_PIX_FMT_ARGB:
993 case AV_PIX_FMT_ABGR:993 case AV_PIX_FMT_ABGR:
994 v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8)) + (255 << (rgba_map[A]*8));994 v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8)) + (255U << (rgba_map[A]*8));
995 p = dst + 4*x + y*dst_linesize;995 p = dst + 4*x + y*dst_linesize;
996 AV_WL32(p, v);996 AV_WL32(p, v);
997 break;997 break;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t