mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-10 06:55:15 +00:00
games/NXDoom: Check visplane capacity before writing.
Move the maximum-visplane guard ahead of the new plane initialization. At full capacity, the previous ordering wrote three fields one element past the visplanes array before reporting the overflow. Assisted-by: Codex:gpt-5 Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
This commit is contained in:
parent
c4bf636057
commit
8bfd83c401
1 changed files with 5 additions and 3 deletions
|
|
@ -451,13 +451,15 @@ visplane_t *r_check_plane(visplane_t *pl, int start, int stop)
|
|||
|
||||
/* make a new visplane */
|
||||
|
||||
if (lastvisplane - visplanes == CONFIG_GAMES_NXDOOM_MAXVISPLANES)
|
||||
{
|
||||
i_error("r_check_plane: no more visplanes");
|
||||
}
|
||||
|
||||
lastvisplane->height = pl->height;
|
||||
lastvisplane->picnum = pl->picnum;
|
||||
lastvisplane->lightlevel = pl->lightlevel;
|
||||
|
||||
if (lastvisplane - visplanes == CONFIG_GAMES_NXDOOM_MAXVISPLANES)
|
||||
i_error("r_check_plane: no more visplanes");
|
||||
|
||||
pl = lastvisplane++;
|
||||
pl->minx = start;
|
||||
pl->maxx = stop;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue