summaryrefslogtreecommitdiff
path: root/src/p_spec.c
diff options
context:
space:
mode:
authorSimon Howard2009-10-10 01:02:58 +0000
committerSimon Howard2009-10-10 01:02:58 +0000
commitcc92d31eeaa40ae966196cfa5402474ffda0bbc7 (patch)
tree225c132d4684a106e66c2a1d864aee8f900618d8 /src/p_spec.c
parenta91a40f18eb3a353025b21bf22599c30f65a1cd3 (diff)
downloadchocolate-doom-cc92d31eeaa40ae966196cfa5402474ffda0bbc7.tar.gz
chocolate-doom-cc92d31eeaa40ae966196cfa5402474ffda0bbc7.tar.bz2
chocolate-doom-cc92d31eeaa40ae966196cfa5402474ffda0bbc7.zip
Don't crash when using the donut special type and the joining linedef is
one sided (thanks Alexander Waldmann). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1711
Diffstat (limited to 'src/p_spec.c')
-rw-r--r--src/p_spec.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/p_spec.c b/src/p_spec.c
index 27042b5d..5bb6f19d 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -1199,6 +1199,24 @@ int EV_DoDonut(line_t* line)
rtn = 1;
s2 = getNextSector(s1->lines[0],s1);
+
+ // Vanilla Doom does not check if the linedef is one sided. The
+ // game does not crash, but reads invalid memory and causes the
+ // sector floor to move "down" to some unknown height.
+ // DOSbox prints a warning about an invalid memory access.
+ //
+ // I'm not sure exactly what invalid memory is being read. This
+ // isn't something that should be done, anyway.
+ // Just print a warning and return.
+
+ if (s2 == NULL)
+ {
+ fprintf(stderr,
+ "EV_DoDonut: linedef had no second sidedef! "
+ "Unexpected behavior may occur in Vanilla Doom. \n");
+ break;
+ }
+
for (i = 0;i < s2->linecount;i++)
{
if ((!s2->lines[i]->flags & ML_TWOSIDED) ||