fte-team / fteqw

This is the official GitHub mirror for the FTEQW project.
https://www.fteqw.org/
181 stars 55 forks source link

Memory fault in Quake 3 Arena (6196) #92

Closed Xylemon closed 1 year ago

Xylemon commented 1 year ago

https://sourceforge.net/p/fteqw/tickets/122/

fhomolka wrote on 2022-02-19:

Fight Ranger in Q3DM1 using Skirmish mode and you'll experience a crash right away when shooting a rocket.

Xylemon commented 1 year ago

fhomolka wrote on 2022-02-24:

Poking around, it seems that the issues were created in [r6167] I'm not sure what exactly the issue is, but I've done some narrowing down.   Related

Commit: [r6167]

Xylemon commented 1 year ago

fhomolka wrote on 2022-03-01:

I might be stating what you maintainers might already have figured out, but I did more poking around. https://sourceforge.net/p/fteqw/code/6167/tree//trunk/engine/gl/gl_alias.c?diff=50cd141e5fcbc911dcf25cc2:6166 This change makes the crash occur. However, I don't think [r6167] causes the issue. R_CalcModelLighting is called, but the e->model is null. Following the rabbit hole backwards reveals that R_Sprite_GenerateTrisoup (the func we're in) is called by BE_GenModelBatches where the pointer to the entity is set. ent = &cl_visedicts[i]; at this point, the model is already null. At least in the case of certain projectiles, like the plasma gun projectile or rocket trail (and something related to the shotgun, but I can't deduce what)

Going back to the diff, if we add another check to that already long line, checking if the model is not null, before all other checks, I can't see the difference from how it was before. I wouldn't call this a "fix", because this skips applying the colour to the entity, but hopefully provides some insight to why the issue occurs.   Related

Commit: [r6167]

Xylemon commented 1 year ago

@eukara wrote on 2022-03-01:

Thank you for looking into this! I've been on a testing spree and thus just cataloguing new issues so I hadn't had the time to debug any of them. You've done a lot to of the legwork on this one so this can get patched up pretty quickly.

Xylemon commented 1 year ago

@eukara wrote on 2022-03-01:

Seems like Spike fixed this overnight!

Xylemon commented 1 year ago

fhomolka wrote on 2022-03-01:

Indeed he has. Sorry for flogging the ticket without checking beforehand