Skip to content
Snippets Groups Projects
Commit be0c062c authored by Alam Ed Arias's avatar Alam Ed Arias
Browse files

Precache: fix off by one, making the precache code write into memory it should not be touching

parent d9298ede
Branches
Tags
Loading
Loading
  • Monster Iestyn @MonsterIestyn ·
    Contributor

    Hm, is it possible for sides[j].toptexture/midtexture/bottomtexture to be -1 or lower? We may want to check for negative numbers in case they get fed into texturepresent (since those fields are INT32, and some of the linedef specials might allow those kind of numbers? I don't know entirely really)

    (I'm referring to the texturepresent[*] = 1 lines just below the changed line btw)

  • ChaoLoveIceMDBoy @chaoloveicemdboy ·
    Contributor

    These memory leaks are probably the cause of huge maps being laggy in 2.1.X. This wasn't really an issue in 2.0.X.

  • Author Maintainer

    @choalover what drugs are you on? This is not a memory leak, this is just to make the memory block we alloc a little bigger for the usage, so we do not write into memory outside of the allocated memory block

    ==32090== Invalid write of size 1
    ==32090==    at 0x8176A53: R_PrecacheLevel (r_data.c:1614)
    ==32090==    by 0x8136D4C: P_SetupLevel (p_setup.c:2811)
    ==32090==    by 0x807F1D1: G_DoLoadLevel (g_game.c:1634)
    ==32090==    by 0x8083AD7: G_InitNew (g_game.c:3618)
    ==32090==    by 0x805FC07: Got_Mapcmd (d_netcmd.c:1778)
    ==32090==    by 0x804D776: ExtraDataTicker (d_clisrv.c:382)
    ==32090==    by 0x80572E8: TryRunTics (d_clisrv.c:4094)
    ==32090==    by 0x804BE1B: D_SRB2Loop (d_main.c:575)
    ==32090==    by 0x804B302: main (i_main.c:240)
    ==32090==  Address 0x1779433d is 11 bytes before a block of size 108 free'd
    ==32090==    at 0x402C3DD: free (vg_replace_malloc.c:529)
    ==32090==    by 0x80763B6: Z_Free2 (z_zone.c:200)
    ==32090==    by 0x81342E4: P_CreateBlockMap (p_setup.c:1771)
    ==32090==    by 0x81364E7: P_SetupLevel (p_setup.c:2569)
    ==32090==    by 0x807F1D1: G_DoLoadLevel (g_game.c:1634)
    ==32090==    by 0x8083AD7: G_InitNew (g_game.c:3618)
    ==32090==    by 0x805FC07: Got_Mapcmd (d_netcmd.c:1778)
    ==32090==    by 0x804D776: ExtraDataTicker (d_clisrv.c:382)
    ==32090==    by 0x80572E8: TryRunTics (d_clisrv.c:4094)
    ==32090==    by 0x804BE1B: D_SRB2Loop (d_main.c:575)
    ==32090==    by 0x804B302: main (i_main.c:240)
    ==32090==  Block was alloc'd at
    ==32090==    at 0x402D45A: malloc (vg_replace_malloc.c:298)
    ==32090==    by 0x8076443: xm (z_zone.c:213)
    ==32090==    by 0x80764EA: Z_Malloc2 (z_zone.c:261)
    ==32090==    by 0x80766F0: Z_Calloc2 (z_zone.c:324)
    ==32090==    by 0x807676F: Z_Realloc2 (z_zone.c:353)
    ==32090==    by 0x81340F7: P_CreateBlockMap (p_setup.c:1728)
    ==32090==    by 0x81364E7: P_SetupLevel (p_setup.c:2569)
    ==32090==    by 0x807F1D1: G_DoLoadLevel (g_game.c:1634)
    ==32090==    by 0x8083AD7: G_InitNew (g_game.c:3618)
    ==32090==    by 0x805FC07: Got_Mapcmd (d_netcmd.c:1778)
    ==32090==    by 0x804D776: ExtraDataTicker (d_clisrv.c:382)
    ==32090==    by 0x80572E8: TryRunTics (d_clisrv.c:4094)
    ==32090==```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment