diff options
author | Ismael Luceno | 2021-12-31 00:27:27 +0100 |
---|---|---|
committer | Ismael Luceno | 2021-12-31 00:58:52 +0100 |
commit | daa3247dbc50c884bdc56a3db058c4ab0a17173d (patch) | |
tree | b9378e030241844cced7b8b7b2066ee5966f09c9 | |
parent | 538b837633934014ad12847e62c20ba2fbab05a8 (diff) |
plib: musl build fixes and security fixes, SECURITY_PATCH++
-rwxr-xr-x | games-libs/plib/BUILD | 5 | ||||
-rwxr-xr-x | games-libs/plib/DETAILS | 1 | ||||
-rw-r--r-- | games-libs/plib/HISTORY | 11 | ||||
-rwxr-xr-x | games-libs/plib/PRE_BUILD | 5 | ||||
-rw-r--r-- | games-libs/plib/patches/CVE-2011-4620.patch | 12 | ||||
-rw-r--r-- | games-libs/plib/patches/CVE-2012-4552.patch | 56 | ||||
-rw-r--r-- | games-libs/plib/patches/CVE-2021-38714.patch | 64 | ||||
-rw-r--r-- | games-libs/plib/patches/dont_break_joystick_system_calibration.patch | 30 | ||||
-rw-r--r-- | games-libs/plib/patches/musl-ushort.patch | 11 | ||||
-rw-r--r-- | games-libs/plib/patches/spelling_errors.patch | 28 |
10 files changed, 216 insertions, 7 deletions
diff --git a/games-libs/plib/BUILD b/games-libs/plib/BUILD deleted file mode 100755 index da96aeaf..00000000 --- a/games-libs/plib/BUILD +++ /dev/null @@ -1,5 +0,0 @@ -# this fixes (again) the problem with NVIDIA GL libs -sedit 's:LIBS="-lGL $LIBS":LIBS="-lGL $LIBS -lgcc_s":' configure && -OPTS="$OPTS --with-GL=/usr/X11R6" && -default_build - diff --git a/games-libs/plib/DETAILS b/games-libs/plib/DETAILS index 7e0ce393..0bd8ecc2 100755 --- a/games-libs/plib/DETAILS +++ b/games-libs/plib/DETAILS @@ -1,5 +1,6 @@ SPELL=plib VERSION=1.8.5 + SECURITY_PATCH=1 SOURCE=$SPELL-$VERSION.tar.gz SOURCE_DIRECTORY=$BUILD_DIRECTORY/$SPELL-$VERSION SOURCE_URL[0]=http://plib.sourceforge.net/dist/$SOURCE diff --git a/games-libs/plib/HISTORY b/games-libs/plib/HISTORY index 932b9976..689c3292 100644 --- a/games-libs/plib/HISTORY +++ b/games-libs/plib/HISTORY @@ -1,3 +1,14 @@ +2021-12-31 Ismael Luceno <ismael@sourcemage.org> + * PRE_BUILD: fixed build against musl and apply patches + * patches/musl-ushort.patch: fixed build against musl + * BUILD: removed, no longer needed + * patches/dont_break_joystick_system_calibration.patch: + added patch to avoid breaking kernel's joystick calibration + * patches/spelling_errors.patch: added fix for spelling errors + * patches/CVE-2011-4620.patch, patches/CVE-2012-4552.patch, + patches/CVE-2021-38714.patch: applied security fixes + * DETAILS: SECURITY_PATCH++ + 2008-09-14 Jaka Kranjc <lynxlynxlynx@sourcemage.org> * PRE_BUILD: fix sdl include, modified patch from skaalil #14721 diff --git a/games-libs/plib/PRE_BUILD b/games-libs/plib/PRE_BUILD index 644558ce..38e35cc0 100755 --- a/games-libs/plib/PRE_BUILD +++ b/games-libs/plib/PRE_BUILD @@ -1,4 +1,5 @@ default_pre_build && cd $SOURCE_DIRECTORY && - -sed -i 's:#include "SDL.h":#include <SDL.h>:' src/pui/puSDL.h +apply_patch_dir patches && +sedit 's:#include "SDL.h":#include <SDL.h>:' src/pui/puSDL.h && +sedit 's!maybe_os in$!& linux-musl*|\\!' config.sub diff --git a/games-libs/plib/patches/CVE-2011-4620.patch b/games-libs/plib/patches/CVE-2011-4620.patch new file mode 100644 index 00000000..455938ac --- /dev/null +++ b/games-libs/plib/patches/CVE-2011-4620.patch @@ -0,0 +1,12 @@ +Description: _CVE 2011 4620.diff +--- a/src/util/ulError.cxx ++++ b/src/util/ulError.cxx +@@ -39,7 +39,7 @@ + { + va_list argp; + va_start ( argp, fmt ) ; +- vsprintf ( _ulErrorBuffer, fmt, argp ) ; ++ vsnprintf ( _ulErrorBuffer, sizeof(_ulErrorBuffer), fmt, argp ) ; + va_end ( argp ) ; + + if ( _ulErrorCB ) diff --git a/games-libs/plib/patches/CVE-2012-4552.patch b/games-libs/plib/patches/CVE-2012-4552.patch new file mode 100644 index 00000000..19cabb5d --- /dev/null +++ b/games-libs/plib/patches/CVE-2012-4552.patch @@ -0,0 +1,56 @@ +Description: _CVE 2012 4552.diff + diff -up plib-1.8.5/src/ssg/ssgParser.cxx~ plib-1.8.5/src/ssg/ssgParser.cxx +--- plib-1.8.5/src/ssg/ssgParser.cxx~ 2008-03-11 03:06:23.000000000 +0100 ++++ plib-1.8.5/src/ssg/ssgParser.cxx 2012-11-01 15:33:12.424483374 +0100 +@@ -57,18 +57,16 @@ void _ssgParser::error( const char *form + char msgbuff[ 255 ]; + va_list argp; + +- char* msgptr = msgbuff; +- if (linenum) +- { +- msgptr += sprintf ( msgptr,"%s, line %d: ", +- path, linenum ); +- } +- + va_start( argp, format ); +- vsprintf( msgptr, format, argp ); ++ vsnprintf( msgbuff, sizeof(msgbuff), format, argp ); + va_end( argp ); + +- ulSetError ( UL_WARNING, "%s", msgbuff ) ; ++ if (linenum) ++ { ++ ulSetError ( UL_WARNING, "%s, line %d: %s", path, linenum, msgbuff ) ; ++ } else { ++ ulSetError ( UL_WARNING, "%s", msgbuff ) ; ++ } + } + + +@@ -78,18 +76,16 @@ void _ssgParser::message( const char *fo + char msgbuff[ 255 ]; + va_list argp; + +- char* msgptr = msgbuff; +- if (linenum) +- { +- msgptr += sprintf ( msgptr,"%s, line %d: ", +- path, linenum ); +- } +- + va_start( argp, format ); +- vsprintf( msgptr, format, argp ); ++ vsnprintf( msgbuff, sizeof(msgbuff), format, argp ); + va_end( argp ); + +- ulSetError ( UL_DEBUG, "%s", msgbuff ) ; ++ if (linenum) ++ { ++ ulSetError ( UL_DEBUG, "%s, line %d: %s", path, linenum, msgbuff ) ; ++ } else { ++ ulSetError ( UL_DEBUG, "%s", msgbuff ) ; ++ } + } + + // Opens the file and does a few internal calculations based on the spec. diff --git a/games-libs/plib/patches/CVE-2021-38714.patch b/games-libs/plib/patches/CVE-2021-38714.patch new file mode 100644 index 00000000..13366772 --- /dev/null +++ b/games-libs/plib/patches/CVE-2021-38714.patch @@ -0,0 +1,64 @@ +Description: Prevent integer overflow in ssgLoadTGA() function. CVE-2021-38714 +Author: Anton Gladky <gladk@debian.org> +Bug-Debian: https://bugs.debian.org/992973 +Last-Update: 2021-10-02 + +Index: plib/src/ssg/ssgLoadTGA.cxx +=================================================================== +--- plib.orig/src/ssg/ssgLoadTGA.cxx ++++ plib/src/ssg/ssgLoadTGA.cxx +@@ -23,6 +23,7 @@ + + + #include "ssgLocal.h" ++#include <new> + + #ifdef SSG_LOAD_TGA_SUPPORTED + +@@ -103,9 +104,9 @@ bool ssgLoadTGA ( const char *fname, ssg + + // image info + int type = header[2]; +- int xsize = get16u(header + 12); +- int ysize = get16u(header + 14); +- int bits = header[16]; ++ unsigned int xsize = get16u(header + 12); ++ unsigned int ysize = get16u(header + 14); ++ unsigned int bits = header[16]; + + /* image types: + * +@@ -169,9 +170,32 @@ bool ssgLoadTGA ( const char *fname, ssg + } + + ++ const auto bytes_to_allocate = (bits / 8) * xsize * ysize; ++ ++ ulSetError( UL_DEBUG, "bytes_to_allocate=%ld xsize = %ld, ysize = %ld, %ld == %ld ", bytes_to_allocate, xsize, ysize, bytes_to_allocate / xsize, (ysize * (bits / 8))); ++ ++ if (xsize != 0 && ((ysize * (bits / 8)) != bytes_to_allocate / xsize)) ++ { ++ ulSetError( UL_WARNING, "Integer overflow in image size: xsize = %d, ysize = %d", xsize, ysize); ++ return false; ++ } ++ else ++ { ++ ulSetError( UL_DEBUG, "ssgLoadTGA: Allocating %ld bytes for the size %d x %d", bytes_to_allocate, xsize, ysize ); ++ } ++ + // read image data + +- GLubyte *image = new GLubyte [ (bits / 8) * xsize * ysize ]; ++ GLubyte *image; ++ try ++ { ++ image = new GLubyte [ bytes_to_allocate ]; ++ } ++ catch (const std::bad_alloc&) ++ { ++ ulSetError( UL_WARNING, "ssgLoadTGA: Allocation of %d bytes failed!", bytes_to_allocate); ++ return false; ++ } + + if ((type & 8) != 0) + { diff --git a/games-libs/plib/patches/dont_break_joystick_system_calibration.patch b/games-libs/plib/patches/dont_break_joystick_system_calibration.patch new file mode 100644 index 00000000..ba904c5c --- /dev/null +++ b/games-libs/plib/patches/dont_break_joystick_system_calibration.patch @@ -0,0 +1,30 @@ +Description: Don't break system calibration settings when a joystick is opened + plib may do additional dead-band management on top of the OS joystick driver, + it should not break system settings for that reason! +Bug: https://sourceforge.net/p/plib/bugs/47/ +Bug-Debian: https://bugs.debian.org/787464 +Author: Florent Rougon <f.rougon@free.fr> +Last-Update: 2015-06-01 +--- a/src/js/jsLinux.cxx ++++ b/src/js/jsLinux.cxx +@@ -79,20 +79,6 @@ + if ( num_axes > _JS_MAX_AXES ) + num_axes = _JS_MAX_AXES ; + +- // Remove any deadband value already done in the kernel. +- // Since we have our own deadband management this is save to do so. +- struct js_corr* corr = new js_corr[ all_axes ] ; +- ioctl ( os->fd, JSIOCGCORR, corr ); +- for ( int i = 0; i < num_axes ; ++i ) { +- if ( corr[ i ] . type == JS_CORR_BROKEN ) { +- int nodeadband = ( corr[ i ] . coef[ 0 ] + corr[ i ] . coef[ 1 ] ) / 2 ; +- corr[ i ] . coef[ 0 ] = nodeadband ; +- corr[ i ] . coef[ 1 ] = nodeadband ; +- } +- } +- ioctl ( os->fd, JSIOCSCORR, corr ); +- delete [] corr; +- + for ( int i = 0 ; i < _JS_MAX_AXES ; i++ ) + { + max [ i ] = 32767.0f ; diff --git a/games-libs/plib/patches/musl-ushort.patch b/games-libs/plib/patches/musl-ushort.patch new file mode 100644 index 00000000..38ca65ed --- /dev/null +++ b/games-libs/plib/patches/musl-ushort.patch @@ -0,0 +1,11 @@ +--- a/src/ssg/ssgLoadFLT.cxx 2008-03-11 03:06:23.000000000 +0100 ++++ b/src/ssg/ssgLoadFLT.cxx 2015-10-31 15:45:55.426989776 +0100 +@@ -142,7 +142,7 @@ + + typedef unsigned char ubyte; + +-#ifdef UL_WIN32 ++#if defined(UL_WIN32) || !defined(__GLIBC__) + typedef unsigned short ushort; + typedef unsigned int uint; + #endif diff --git a/games-libs/plib/patches/spelling_errors.patch b/games-libs/plib/patches/spelling_errors.patch new file mode 100644 index 00000000..3f56a7db --- /dev/null +++ b/games-libs/plib/patches/spelling_errors.patch @@ -0,0 +1,28 @@ +Description: Fix spelling errors in code + s/implmented/implemented, s/adress/address +Author: Tobias Frost <tobi@debian.org> +Last-Update: 2017-07-24 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/src/ssg/ssgSaveDXF.cxx ++++ b/src/ssg/ssgSaveDXF.cxx +@@ -102,7 +102,7 @@ + } + } + else +- ulSetError ( UL_WARNING, "ssgSaveDXF: OpenGL mode %d not implmented yet. Parts or all of the model are ignored!' for writing", (int)mode ) ; ++ ulSetError ( UL_WARNING, "ssgSaveDXF: OpenGL mode %d not implemented yet. Parts or all of the model are ignored!' for writing", (int)mode ) ; + } + + +--- a/src/ssg/ssgLoadMDL.cxx ++++ b/src/ssg/ssgLoadMDL.cxx +@@ -1858,7 +1858,7 @@ + fseek(fp, -12, SEEK_CUR); + unsigned long addr = ftell(fp); + if(addr&1L) +- printf("strange... found RIFF, but on an odd adress %lx\n", addr); ++ printf("strange... found RIFF, but on an odd address %lx\n", addr); + else + printf("found a good RIFF header at address %lx\n", addr); + FindBGLBeginRIFF(fp); |