Clear g_dc each frame

I was running into a memcpy of overlapping memory regions
in R_RenderMaskedSegRange.

- This is because of the reallocation of lightlists, which
  uses Z_Frame_Alloc.
- The memory pool that Z_Frame_Alloc draws from is cleared
  each frame.
- g_dc was not cleared though, so when the lightlists were
  reallocated, it'd try to copy from invalidated pointers.
- Access to invalid pointers within the memory pool does
  not cause a segfault directly (because the memory pool
  is allocated once). However, a memcpy involving such an
  invalid pointer leads to overlap, which may cause memory
  corruption.
This commit is contained in:
James R 2024-02-03 00:53:06 -08:00
parent 924d46d102
commit 93ff380730

View file

@ -856,6 +856,7 @@ void D_SRB2Loop(void)
precise_t enterprecise = I_GetPreciseTime();
precise_t finishprecise = enterprecise;
g_dc = {};
Z_Frame_Reset();
{