From c808041337243fed221909c147ea9629e62325de Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 9 Jun 2006 00:26:07 +0000 Subject: [PATCH] - Fixed: Trying to play a 0-length song from a wad inside a zip caused a crash. SVN r181 (trunk) --- Makefile.mingw | 2 +- docs/rh-log.txt | 3 +++ src/nodebuild.cpp | 1 - src/nodebuild_utility.cpp | 4 ++-- src/r_plane.cpp | 6 ++++-- src/r_segs.cpp | 6 ++++-- src/s_sound.cpp | 5 +++++ 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Makefile.mingw b/Makefile.mingw index 181f75754..ba34e25c0 100644 --- a/Makefile.mingw +++ b/Makefile.mingw @@ -397,7 +397,7 @@ $(OBJDIR)/%.o : %.cpp # This file needs special handling so that it actually gets compiled with SSE2 support. $(OBJDIR)/nodebuild_classify_sse2.o: nodebuild_classify_sse2.cpp - $(CCDV) $(CXX) $(CXXFLAGS) -msse2 -mfpmath=sse -c -o $@ $< + $(CCDV) $(CXX) $(CXXFLAGS) -msse2 -mfpmath=sse -c -o $@ $< $(OBJDIR)/%.o : %.nas $(CCDV) nasmw -o $@ -f win32 $< diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 452fabfda..1ecff027a 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,6 @@ +June 8, 2006 +- Fixed: Trying to play a 0-length song from a wad inside a zip caused a crash. + June 7, 2006 (Changes by Graf Zahl) - Fixed: A_CustomPunch didn't use the range parameter correctly. diff --git a/src/nodebuild.cpp b/src/nodebuild.cpp index e9d76cc9b..f149963e2 100644 --- a/src/nodebuild.cpp +++ b/src/nodebuild.cpp @@ -748,7 +748,6 @@ void FNodeBuilder::SplitSegs (DWORD set, node_t &node, DWORD splitseg, DWORD &ou FPrivVert newvert; unsigned int vertnum; int seg2; - unsigned int i; if (seg->loopnum) { diff --git a/src/nodebuild_utility.cpp b/src/nodebuild_utility.cpp index 528f59349..c49117b37 100644 --- a/src/nodebuild_utility.cpp +++ b/src/nodebuild_utility.cpp @@ -102,8 +102,8 @@ void FNodeBuilder::FindUsedVertices (vertex_t *oldverts, int max) map[v2] = VertexMap->SelectVertexExact (newvert); } - Level.Lines[i].v1 = (vertex_t *)map[v1]; - Level.Lines[i].v2 = (vertex_t *)map[v2]; + Level.Lines[i].v1 = (vertex_t *)(size_t)map[v1]; + Level.Lines[i].v2 = (vertex_t *)(size_t)map[v2]; } } diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 57cf520a7..655b0fdcd 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -1148,8 +1148,10 @@ void R_DrawSkyBoxes () FirstInterestingDrawseg = InterestingDrawsegs.Size(); interestingStack.Push (FirstInterestingDrawseg); - drawsegStack.Push (firstdrawseg - drawsegs); - visspriteStack.Push (firstvissprite - vissprites); + ptrdiff_t diffnum = firstdrawseg - drawsegs; + drawsegStack.Push (diffnum); + diffnum = firstvissprite - vissprites; + visspriteStack.Push (diffnum); viewxStack.Push (viewx); viewyStack.Push (viewy); viewzStack.Push (viewz); diff --git a/src/r_segs.cpp b/src/r_segs.cpp index f4e21fbf4..1475ea5a5 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -1539,7 +1539,8 @@ void R_StoreWallRange (int start, int stop) if (rw_markmirror) { - WallMirrors.Push (ds_p - drawsegs); + size_t drawsegnum = ds_p - drawsegs; + WallMirrors.Push (drawsegnum); ds_p->silhouette = SIL_BOTH; } else if (backsector == NULL) @@ -1647,7 +1648,8 @@ void R_StoreWallRange (int start, int stop) if (ds_p->bFogBoundary || ds_p->maskedtexturecol != -1) { - InterestingDrawsegs.Push (ds_p - drawsegs); + size_t drawsegnum = ds_p - drawsegs; + InterestingDrawsegs.Push (drawsegnum); } } } diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 9c882d62e..101ec8d16 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -1520,6 +1520,11 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force) offset = -1; // this tells the low level code that the music // is being used from memory length = Wads.LumpLength (lumpnum); + if (length == 0) + { + offset = 0; + return false; + } musiccache.Resize(length); Wads.ReadLump(lumpnum, &musiccache[0]); }