diff --git a/SOURCES/update-xscreensaver-hacks b/SOURCES/update-xscreensaver-hacks new file mode 100644 index 0000000..5a77fb2 --- /dev/null +++ b/SOURCES/update-xscreensaver-hacks @@ -0,0 +1,92 @@ +#!/bin/bash + +_SYSCONFDIR=${sysconfdir:-/etc} +_PREFIX=${prefix:-/usr} +_DATADIR=${datadir:-${_PREFIX}/share} + +ADDIR=${ADDIR:-${install_prefix}${_SYSCONFDIR}/xscreensaver} +CONFDIR=${CONFDIR:-${install_prefix}${_DATADIR}/xscreensaver/hacks.conf.d} +ADFILE=${ADFILE:-$ADDIR/XScreenSaver.ad} + +fix_hackconf () +{ + if [ ! -s $1 ] ; then + echo "$1 is empty" >&2 + echo "" + return 1 + fi + + tmpconf=`mktemp /tmp/hackconf.XXXXXXXX` + tmpconf_1=`mktemp /tmp/hackconf.XXXXXXXX` + tmpconf_2=`mktemp /tmp/hackconf.XXXXXXXX` + tmpconf_3=`mktemp /tmp/hackconf.XXXXXXXX` + sed -n -e '$p' $1 > $tmpconf_1 + sed -e '$d' $1 > $tmpconf_2 + for file in $tmpconf_1 $tmpconf_2 ; do + if ( [ -s $file ] && grep -q '\\n\(\|\\\)[^\\].*$' $file ) ; then + rm -f $tmpconf $tmpconf_1 $tmpconf_2 $tmpconf_3 + echo "" + echo "ignoring $1" >&2 + return 1 + fi + done + if ! grep -q '\\n[\\]*$' $tmpconf_1 ; then + sed -i -e 's|\(^.*$\)|\1 \\n\\|' $tmpconf_1 + fi + sed -i -e 's|\\n$|\\n\\|' $tmpconf_1 + while [ -s $tmpconf_2 ] ; do + sed -n -e '1p' $tmpconf_2 > $tmpconf_3 + sed -i -e '1d' $tmpconf_2 + if ! grep -q '\([ \t]\\$\|\\n\\$\)' $tmpconf_3 ; then + rm -f $tmpconf $tmpconf_1 $tmpconf_2 $tmpconf_3 + echo "" + echo "ignoring $1" >&2 + return 1 + fi + cat $tmpconf_3 >> $tmpconf + done + cat $tmpconf_1 >> $tmpconf + rm -f $tmpconf_1 $tmpconf_2 $tmpconf_3 + echo $tmpconf + return 0 + +} + +for suffix in header tail ; do + if [ ! -r $ADDIR/XScreenSaver.ad.$suffix ] ; then + echo "$ADDIR/XScreenSaver.ad.$suffix missing" + exit 1 + fi +done + +tmpfile=`mktemp /tmp/XScreenSaver.ad.XXXXXXXX` + +cat > $tmpfile <> $tmpfile + +for hackconf in $CONFDIR/*.conf ; do + hackconf_fixed=`fix_hackconf $hackconf` + if [ -n "$hackconf_fixed" ] ; then + cat $hackconf_fixed >> $tmpfile + rm -f $hackconf_fixed + fi +done +sed -i -e '$s|\\n\\$|\\n|' $tmpfile + +cat $ADDIR/XScreenSaver.ad.tail >> $tmpfile +install -c -p -m 644 $tmpfile $ADFILE +rm -f $tmpfile + + diff --git a/SOURCES/xscreensaver-5.39-0003-crumbler-fix-loop-enclosure-for-calculating-keys-in-.patch b/SOURCES/xscreensaver-5.39-0003-crumbler-fix-loop-enclosure-for-calculating-keys-in-.patch new file mode 100644 index 0000000..ce4e3a4 --- /dev/null +++ b/SOURCES/xscreensaver-5.39-0003-crumbler-fix-loop-enclosure-for-calculating-keys-in-.patch @@ -0,0 +1,36 @@ +From 337d06b4c2f5f779de835c5eb54846db330b33cf Mon Sep 17 00:00:00 2001 +From: XScreenSaver owners +Date: Mon, 16 Apr 2018 21:39:38 +0900 +Subject: [PATCH] crumbler: fix loop enclosure for calculating keys in + split_chunk + +In split_chunk(), unique keys should be assigned to each chunks, +however current loop for calculating keys has logical mistake. +Fix this. +--- + hacks/glx/crumbler.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/hacks/glx/crumbler.c b/hacks/glx/crumbler.c +index f9a908a..b4420e7 100644 +--- a/hacks/glx/crumbler.c ++++ b/hacks/glx/crumbler.c +@@ -352,12 +352,14 @@ split_chunk (ModeInfo *mi, chunk *c, int nchunks) + do { + keys[i] = random() % c->nverts; + for (j = 0; j < i; j++) ++ { + if (keys[i] == keys[j]) + { + ok = False; + break; + } +- ok = True; ++ ok = True; ++ } + } while (!ok); + + c2 = make_chunk(); +-- +2.17.0 + diff --git a/SOURCES/xscreensaver-5.39-0004-xscreensaver-getimage-avoid-substitution-to-NULL-poi.patch b/SOURCES/xscreensaver-5.39-0004-xscreensaver-getimage-avoid-substitution-to-NULL-poi.patch new file mode 100644 index 0000000..2a8351e --- /dev/null +++ b/SOURCES/xscreensaver-5.39-0004-xscreensaver-getimage-avoid-substitution-to-NULL-poi.patch @@ -0,0 +1,44 @@ +From e0f453603296e55ca2588b822b840d724d535893 Mon Sep 17 00:00:00 2001 +From: Mamoru TASAKA +Date: Wed, 20 Jun 2018 18:21:45 +0900 +Subject: [PATCH] xscreensaver-getimage: avoid substitution to NULL pointer + +When user chooses not to use any image resource on "Image Manupulation" +in xscreensaver-demo, xscreensaver-getimage program tries to do +GRAB_BARS mode, then calls colorbars() function and it causes segfault +like: + +#0 0x000055555556227a in minixpm_to_ximage (dpy=dpy@entry=0x555555788b10, visual=visual@entry=0x555555795dd0, colormap=colormap@entry=32, depth=depth@entry=24, transparent_color=, data=, data@entry=0x555555775e80 , width_ret=0x7fffffffcb30, height_ret=0x7fffffffcb34, pixels_ret=0x0, npixels_ret=0x0, mask_ret=0x7fffffffcb38) at ../../utils/minixpm.c:248 +#1 0x0000555555561b93 in xscreensaver_logo (screen=screen@entry=0x55555578a1d0, visual=visual@entry=0x555555795dd0, drawable=drawable@entry=707, cmap=cmap@entry=32, background_color=, pixels_ret=pixels_ret@entry=0x0, npixels_ret=0x0, mask_ret=0x7fffffffccf0, big_p=1) at ../../utils/logo.c:49 +#2 0x000055555555ab5f in colorbars (cmap=32, drawable=707, visual=0x555555795dd0, screen=0x55555578a1d0) at ../../driver/xscreensaver-getimage.c:319 +#3 0x000055555555ab5f in get_image (screen=, file=, dir=, image_p=, video_p=, desk_p=, verbose_p=0, drawable=707, window=707) at ../../driver/xscreensaver-getimage.c:1697 +#4 0x000055555555ab5f in main (argc=, argv=) at ../../driver/xscreensaver-getimage.c:1994 +#5 0x00007ffff54d818b in __libc_start_main (main=0x55555555a4f0
, argc=2, argv=0x7fffffffd428, init=, fini=, rtld_fini=, stack_end=0x7fffffffd418) + at ../csu/libc-start.c:308 + +This patch avoids NULL pointer accessment, as xscreensaver 5.38 was doing +in (5.38) draw_colorbars() function. +--- + driver/xscreensaver-getimage.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/driver/xscreensaver-getimage.c b/driver/xscreensaver-getimage.c +index b9715ae..6cf5c99 100644 +--- a/driver/xscreensaver-getimage.c ++++ b/driver/xscreensaver-getimage.c +@@ -316,9 +316,11 @@ static void + colorbars (Screen *screen, Visual *visual, Drawable drawable, Colormap cmap) + { + Pixmap mask = 0; ++ unsigned long *pixels; /* ignored - unfreed */ ++ int npixels; + Pixmap logo = xscreensaver_logo (screen, visual, drawable, cmap, + BlackPixelOfScreen (screen), +- 0, 0, &mask, True); ++ &pixels, &npixels, &mask, True); + draw_colorbars (screen, visual, drawable, cmap, 0, 0, 0, 0, logo, mask); + XFreePixmap (DisplayOfScreen (screen), logo); + XFreePixmap (DisplayOfScreen (screen), mask); +-- +2.17.1 + diff --git a/SPECS/xscreensaver.spec b/SPECS/xscreensaver.spec index abbe449..892fa0e 100644 --- a/SPECS/xscreensaver.spec +++ b/SPECS/xscreensaver.spec @@ -10,7 +10,7 @@ %define split_getimage 1 %endif -%define fedora_rel 1 +%define fedora_rel 6 %global use_clang_as_cc 0 %global use_clang_analyze 0 @@ -89,6 +89,10 @@ Patch3607: xscreensaver-5.36-0007-misc-kill-gcc-warn_unused_result-warning Patch3901: xscreensaver-5.39-0001-driver-Makefile.in-fix-path-for-font-retry.o.patch # crumbler: fix color overvalue when accessing colors array Patch3902: xscreensaver-5.39-0002-crumbler-fix-color-overvalue-when-accessing-colors-a.patch +# crumbler: fix loop enclosure for calculating keys in split_chunk +Patch3903: xscreensaver-5.39-0003-crumbler-fix-loop-enclosure-for-calculating-keys-in-.patch +# xscreensaver-getimage: avoid substitution to NULL pointer on GRAB_BARS mode +Patch3904: xscreensaver-5.39-0004-xscreensaver-getimage-avoid-substitution-to-NULL-poi.patch # # Debugging patch # Not apply by default @@ -344,6 +348,9 @@ EOF # Firstly clean this rm -f driver/XScreenSaver_ad.h +# chmod +find . -name \*.c -exec chmod ugo-x {} \; + %__git init %__git config user.email "xscreensaver-owner@fedoraproject.org" %__git config user.name "XScreenSaver owners" @@ -366,6 +373,8 @@ rm -f driver/XScreenSaver_ad.h #%%__cat %PATCH3607 | %__git am %__cat %PATCH3901 | %__git am %__cat %PATCH3902 | %__git am +%__cat %PATCH3903 | %__git am +%__cat %PATCH3904 | %__git am #%%__cat %PATCH13501 | %%__git am @@ -549,7 +558,8 @@ ln -sf /bin/true xdg-open popd export CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" -export CFLAGS="$(echo $CFLAGS | sed -e 's|-g |-g3 |')" +# Doesn't work well when generating debuginfo... +# export CFLAGS="$(echo $CFLAGS | sed -e 's|-g |-g3 -ggdb |')" %if 0%{?fedora} >= 24 export CFLAGS="$CFLAGS -Wno-long-long" @@ -1051,6 +1061,18 @@ exit 0 %endif %changelog +* Wed Jun 20 2018 Mamoru TASAKA - 1:5.39-6 +- xscreensaver-getimage: avoid substitution to NULL pointer on GRAB_BARS mode + +* Mon May 28 2018 Mamoru TASAKA - 1:5.39-5 +- Reback to -g from -g3 to fix debuginfo generation (c.f. bug 1582631) + +* Wed Apr 25 2018 Mamoru TASAKA - 1:5.39-4 +- Actually apply patch 3903 + +* Mon Apr 16 2018 Mamoru TASAKA - 1:5.39-3 +- crumbler: fix loop enclosure for calculating keys in split_chunk + * Sun Apr 15 2018 Mamoru TASAKA - 1:5.39-2 - crumbler: fix color overvalue when accessing colors array