From 954db90918db5532463612a0ec6a891e463a57b7 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Tue, 29 Apr 2014 10:15:47 -0400 Subject: [PATCH] videotestsrc: fix undefined behaviour of left-shift With a small type for the color values being left-shifted, the result is undefined and it could potentially overflow. https://bugzilla.gnome.org/show_bug.cgi?id=729195 --- gst/videotestsrc/videotestsrc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst/videotestsrc/videotestsrc.c b/gst/videotestsrc/videotestsrc.c index 1235782..b4adf90 100644 --- a/gst/videotestsrc/videotestsrc.c +++ b/gst/videotestsrc/videotestsrc.c @@ -1134,9 +1134,9 @@ paint_tmpline_AYUV (paintinfo * p, int x, int w) #if G_BYTE_ORDER == G_LITTLE_ENDIAN value = (p->color->A << 0) | (p->color->Y << 8) | - (p->color->U << 16) | (p->color->V << 24); + (p->color->U << 16) | ((guint32) p->color->V << 24); #else - value = (p->color->A << 24) | (p->color->Y << 16) | + value = ((guint32) p->color->A << 24) | (p->color->Y << 16) | (p->color->U << 8) | (p->color->V << 0); #endif -- 2.7.4