From 21a80fb2fcb9699c61566231765a1c5c77aa7a7e Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 27 Jan 2017 09:05:07 +0100 Subject: [PATCH] Fix NULL dereference (RHBZ #1416945) Signed-off-by: Igor Gnatenko --- SDL2-2.0.5-null-deref.patch | 45 +++++++++++++++++++++++++++++++++++++ SDL2.spec | 7 +++++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 SDL2-2.0.5-null-deref.patch diff --git a/SDL2-2.0.5-null-deref.patch b/SDL2-2.0.5-null-deref.patch new file mode 100644 index 0000000..cfe0e4a --- /dev/null +++ b/SDL2-2.0.5-null-deref.patch @@ -0,0 +1,45 @@ + +# HG changeset patch +# User Sam Lantinga +# Date 1477183983 25200 +# Node ID fbf9b0e3589a1f88e2eefbbeb3b632e2da795fde +# Parent 5184186d4366169617b434f5b71c618a7035cde4 +Fixed NULL pointer dereference, thanks Ozkan Sezer + +diff -r 5184186d4366 -r fbf9b0e3589a src/video/SDL_blit_N.c +--- a/src/video/SDL_blit_N.c Sat Oct 22 11:01:55 2016 -0700 ++++ b/src/video/SDL_blit_N.c Sat Oct 22 17:53:03 2016 -0700 +@@ -125,11 +125,7 @@ + 0x0C); + vector unsigned char vswiz; + vector unsigned int srcvec; +-#define RESHIFT(X) (3 - ((X) >> 3)) +- Uint32 rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift); +- Uint32 gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift); +- Uint32 bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift); +- Uint32 amask; ++ Uint32 rmask, gmask, bmask, amask; + + if (!srcfmt) { + srcfmt = &default_pixel_format; +@@ -138,6 +134,11 @@ + dstfmt = &default_pixel_format; + } + ++#define RESHIFT(X) (3 - ((X) >> 3)) ++ rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift); ++ gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift); ++ bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift); ++ + /* Use zero for alpha if either surface doesn't have alpha */ + if (dstfmt->Amask) { + amask = +@@ -149,6 +150,7 @@ + 0xFFFFFFFF); + } + #undef RESHIFT ++ + ((unsigned int *) (char *) &srcvec)[0] = (rmask | gmask | bmask | amask); + vswiz = vec_add(plus, (vector unsigned char) vec_splat(srcvec, 0)); + return (vswiz); + diff --git a/SDL2.spec b/SDL2.spec index 417cab1..559ec39 100644 --- a/SDL2.spec +++ b/SDL2.spec @@ -1,6 +1,6 @@ Name: SDL2 Version: 2.0.5 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A cross-platform multimedia library License: zlib and MIT @@ -11,6 +11,8 @@ Source1: SDL_config.h Patch0: multilib.patch # https://hg.libsdl.org/SDL/rev/5184186d4366 Patch1: %{name}-2.0.5-ppc.patch +# https://hg.libsdl.org/SDL/rev/fbf9b0e3589a +Patch2: %{name}-2.0.5-null-deref.patch BuildRequires: alsa-lib-devel BuildRequires: audiofile-devel @@ -119,6 +121,9 @@ rm -f %{buildroot}%{_libdir}/*.la %{_libdir}/lib*.a %changelog +* Fri Jan 27 2017 Igor Gnatenko - 2.0.5-3 +- Fix NULL dereference (RHBZ #1416945) + * Wed Oct 26 2016 Dan HorĂ¡k - 2.0.5-2 - fix FTBFS on ppc64/ppc64le