[chocolate-doom] 08/42: Guard against music lumps containing non-MUS data, document in bugs list

Jonathan Dowland jmtd at moszumanska.debian.org
Mon Jan 30 15:06:50 UTC 2017


This is an automated email from the git hooks/post-receive script.

jmtd pushed a commit to annotated tag chocolate-doom-0.1.0
in repository chocolate-doom.

commit 33b6861e500ee5483e89e325008fea68627efbd3
Author: Simon Howard <fraggle at gmail.com>
Date:   Sun Oct 2 20:23:04 2005 +0000

    Guard against music lumps containing non-MUS data, document in bugs list
    
    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 152
---
 BUGS          |  7 +++++++
 src/i_sound.c | 13 +++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/BUGS b/BUGS
index 0be0c8f..990ef7e 100644
--- a/BUGS
+++ b/BUGS
@@ -20,3 +20,10 @@
   big-endian systems.  On 64-bit systems savegames may be entirely
   nonfunctional.
 
+* Some music which works in Vanilla Doom does not work in Chocolate Doom
+
+  An example is the music on the title screen of deca.wad.  The music here
+  does not seem to be in the .mus format, yet somehow plays in Vanilla
+  Doom nonetheless.  Attempting to convert it using the mmus2mid code 
+  used in Chocolate Doom results in a crash.
+
diff --git a/src/i_sound.c b/src/i_sound.c
index 45ead1a..18be082 100644
--- a/src/i_sound.c
+++ b/src/i_sound.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_sound.c 102 2005-09-11 23:57:08Z fraggle $
+// $Id: i_sound.c 152 2005-10-02 20:23:04Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.20  2005/10/02 20:23:04  fraggle
+// Guard against music lumps containing non-MUS data, document in bugs list
+//
 // Revision 1.19  2005/09/11 23:57:08  fraggle
 // Remove temporary MIDI files generated by sound code.
 //
@@ -93,7 +96,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_sound.c 102 2005-09-11 23:57:08Z fraggle $";
+rcsid[] = "$Id: i_sound.c 152 2005-10-02 20:23:04Z fraggle $";
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -570,6 +573,12 @@ void *I_RegisterSong(void *data, int len)
     if (!music_initialised)
         return NULL;
     
+    // MUS files begin with "MUS"
+    // Reject anything which doesnt have this signature
+
+    if (len < 3 || memcmp(data, "MUS", 3) != 0)
+        return NULL;
+    
 #ifdef _WIN32
     sprintf(filename, "doom.mid");
 #else

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/chocolate-doom.git



More information about the Pkg-games-commits mailing list