From ddf78069650f65e9ca56915a150923c1959fa5fc Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Dec 03 2008 16:09:09 +0000 Subject: - Fix a buffer overflow crash (bz 473374) --- diff --git a/Duel3_20060225-fix-buf-oflow.patch b/Duel3_20060225-fix-buf-oflow.patch new file mode 100644 index 0000000..16dfdd7 --- /dev/null +++ b/Duel3_20060225-fix-buf-oflow.patch @@ -0,0 +1,12 @@ +diff -up Duel3_20060225_src/Source/Player.cpp~ Duel3_20060225_src/Source/Player.cpp +--- Duel3_20060225_src/Source/Player.cpp~ 2008-12-03 16:46:42.000000000 +0100 ++++ Duel3_20060225_src/Source/Player.cpp 2008-12-03 16:46:42.000000000 +0100 +@@ -111,7 +111,7 @@ void Player::drawHotSeatHUD(int playerNu + //if(blue_bar.retExist()==false) + // blue_bar.setPict(161,10,"w_hud/blue_bar.bmp"); + +- char ammo_left[4], shield_percent[5], armour_percent[5], lives_left[4]; ++ char ammo_left[5], shield_percent[5], armour_percent[5], lives_left[4]; + int xPos,yPos; + + if(ship.retWepHoming()==true) //only display the tageting reticle if a weapon with homing is selected diff --git a/Duel3_20060225-windowed-mode.patch b/Duel3_20060225-windowed-mode.patch new file mode 100644 index 0000000..0e00849 --- /dev/null +++ b/Duel3_20060225-windowed-mode.patch @@ -0,0 +1,60 @@ +diff -up Duel3_20060225_src/Source/main.cpp~ Duel3_20060225_src/Source/main.cpp +--- Duel3_20060225_src/Source/main.cpp~ 2008-12-03 16:58:58.000000000 +0100 ++++ Duel3_20060225_src/Source/main.cpp 2008-12-03 16:56:14.000000000 +0100 +@@ -119,6 +119,7 @@ volatile int sec=0; + int iGraphicsLoops=0; + int iLogicLoops=0; + bool bQuitGame=false; ++bool bFullScreen=true; + #ifdef __unix__ + int check_and_create_dir(const char* dir); + char *homedir; +@@ -240,6 +241,13 @@ int cur_song_num=rand()%3; + + int main(int argc, const char **argv) + { ++ if (argc == 2 && !strcmp(argv[1], "-w")) ++ bFullScreen = false; ++ else if (argc != 1) { ++ printf("Usage: duel3 [-w]\nPass -w to run in windowed mode\n"); ++ return 1; ++ } ++ + #ifdef __unix__ + homedir = getenv("HOME"); + homedir = homedir?homedir:(char *)"."; +@@ -796,6 +804,8 @@ void loadShipDefs(char *filename) + + int initAllegroGL(void) + { ++ int res; ++ + outtext(LOGFILE,"INIT ALLEGROGL\n"); + allegro_init(); + install_allegro_gl(); +@@ -806,7 +816,10 @@ int initAllegroGL(void) + allegro_gl_clear_settings(); + allegro_gl_set (AGL_COLOR_DEPTH, 32); + allegro_gl_set (AGL_Z_DEPTH, 16); +- allegro_gl_set (AGL_FULLSCREEN, TRUE); ++ if (bFullScreen) ++ allegro_gl_set (AGL_FULLSCREEN, TRUE); ++ else ++ allegro_gl_set (AGL_FULLSCREEN, FALSE); + allegro_gl_set (AGL_DOUBLEBUFFER, 1); + allegro_gl_set (AGL_RENDERMETHOD, 1); + allegro_gl_set (AGL_SUGGEST, AGL_COLOR_DEPTH | AGL_Z_DEPTH | AGL_DOUBLEBUFFER +@@ -815,7 +828,12 @@ int initAllegroGL(void) + + outtext(LOGFILE,"Setting gfx mode\n"); + set_color_depth (32); +- if (set_gfx_mode(GFX_OPENGL_FULLSCREEN/*WINDOWED*//*FULLSCREEN*/, 800, 600, 0, 0) < 0) { ++ if (bFullScreen) ++ res = set_gfx_mode(GFX_OPENGL_FULLSCREEN, 800, 600, 0, 0); ++ else ++ res = set_gfx_mode(GFX_OPENGL_WINDOWED, 800, 600, 0, 0); ++ ++ if (res < 0) { + outtext(LOGFILE,"!!Error setting gfx mode!!\n"); + allegro_message ("Error setting graphics mode:\n%s\n", allegro_error); + return -1; diff --git a/duel3.spec b/duel3.spec index d494138..262ffdd 100644 --- a/duel3.spec +++ b/duel3.spec @@ -1,7 +1,7 @@ %define snapshot 20060225 Name: duel3 Version: 0.1 -Release: 0.5.%{snapshot}%{?dist} +Release: 0.6.%{snapshot}%{?dist} Summary: One on one spaceship duel in a 2D arena Group: Amusements/Games License: BSD @@ -12,6 +12,8 @@ Source2: %{name}.desktop Source3: %{name}.png Source4: music-credits.txt Patch0: Duel3_20060225-fixes.patch +Patch1: Duel3_20060225-windowed-mode.patch +Patch2: Duel3_20060225-fix-buf-oflow.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: alleggl-devel dumb-devel libGLU-devel desktop-file-utils Requires: hicolor-icon-theme opengl-games-utils @@ -41,7 +43,9 @@ the arena itself in fast-paced space combat. %setup -q -a 1 -n Duel3_%{snapshot}_src mv Duel3_%{snapshot}_bin/* Source cp %{SOURCE4} . -%patch0 -p1 -z .fixes +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 sed -i 's/\r//' Source/readme.txt license.txt music-credits.txt @@ -96,6 +100,9 @@ fi %changelog +* Wed Dec 3 2008 Hans de Goede 0.1-0.6.20060225 +- Fix a buffer overflow crash (bz 473374) + * Tue Feb 19 2008 Fedora Release Engineering - 0.1-0.5.20060225 - Autorebuild for GCC 4.3