Code Monkey home page Code Monkey logo

Comments (8)

AXDOOMER avatar AXDOOMER commented on May 10, 2024 1

@fabiangreffrath I implemented your fix in my source port and it works as expected.

AXDOOMER/doom-vanille@56ccf3a

from chocolate-doom.

jmtd avatar jmtd commented on May 10, 2024

WAD in question: http://www.doomworld.com/idgames/levels/doom2/deathmatch/Ports/s-u/shdwpit

from chocolate-doom.

fabiangreffrath avatar fabiangreffrath commented on May 10, 2024

This happens because R_CheckPlane() does not have a check if MAXVISPLANES is reached before making a new one and R_FindPlane() only checks for (lastvisplane - visplanes == MAXVISPLANES), not >=.

from chocolate-doom.

mfrancis95 avatar mfrancis95 commented on May 10, 2024

You can add a NULL check to the visplane in R_CheckPlane and error out early, and this seems to catch it, but I don't think this is the most ideal way of solving the issue.

diff --git a/src/doom/r_plane.c b/src/doom/r_plane.c
index 16dde4c2..db882e57 100644
--- a/src/doom/r_plane.c
+++ b/src/doom/r_plane.c
@@ -266,7 +266,11 @@ R_CheckPlane
     int		unionl;
     int		unionh;
     int		x;
-	
+    if (pl == NULL)
+    {
+        I_Error ("R_DrawPlanes: visplane overflow (%" PRIiPTR ")",
+         lastvisplane - visplanes);
+    }
     if (start < pl->minx)
     {
 	intrl = pl->minx;

from chocolate-doom.

fabiangreffrath avatar fabiangreffrath commented on May 10, 2024

A pointer pointing past the visplanes[] array isn't necessarily a NULL pointer.

--- a/src/doom/r_plane.c
+++ b/src/doom/r_plane.c
@@ -307,6 +307,9 @@ R_CheckPlane
     lastvisplane->picnum = pl->picnum;
     lastvisplane->lightlevel = pl->lightlevel;
     
+    if (lastvisplane - visplanes == MAXVISPLANES)
+       I_Error ("R_CheckPlane: no more visplanes");
+
     pl = lastvisplane++;
     pl->minx = start;
     pl->maxx = stop;

from chocolate-doom.

mfrancis95 avatar mfrancis95 commented on May 10, 2024

So @fabiangreffrath could that be merged in? Is there anything else that would need to be done?

from chocolate-doom.

fabiangreffrath avatar fabiangreffrath commented on May 10, 2024

I expressed some objections against your approach, but have none against mine. 😉 Could you confirm that it works as expected?

from chocolate-doom.

AXDOOMER avatar AXDOOMER commented on May 10, 2024

Is something else than the VPO wrong with this map? It won't even run in Doom+. It locks up with the music playing, either there's a missing player 1 start position or there's more than 1024 visplanes. I don't have tools to check.

from chocolate-doom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.