MantisBT - Zandronum
View Issue Details
0003913Zandronum[All Projects] Bugpublic2021-10-28 20:072021-12-04 18:17
Mr. Satan 
Kaminsky 
normalcrashalways
resolvedfixed 
MicrosoftWindows8.1
3.1-beta 
3.1-beta 
0003913: Zandro crashes on exit when CF 4.x is loaded.
Zandronum X64 build 211026-1439 crashes when CF is loaded, then Zandro is exited via menu or the close button in windowed mode. This happens in full screen or windowed mode.

Unhandled exception at 0x00007FF60CD44F3F in zandronum.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
Load CF.
bulletpuff_fix.wad
complex-doom.v26a2.pk3
lca-v1.5.9.6.pk3
randomons-1.2.5.1.pk3
complex-clusterfuck-v4.1.2
Start then Zandro then exit.
while (*cp != 0)
{
  // 28 is the escape code for a color change.
  if ((*cp == 28 && bpos != 0) || bpos == 255)
  {
    buf[bpos] = 0;
    if (edit != NULL)
    {
      ToEditControl(edit, buf, wbuf, bpos);
    }
    if (StdOut != NULL)
    {
      DWORD bytes_written;
      WriteFile(StdOut, buf, bpos, &bytes_written, NULL);
    }
    bpos = 0;
  }
  if (*cp != 28)
  {
    buf[bpos++] = *cp++;
  }
  else
  {
    const BYTE *color_id = (const BYTE *)cp + 1;
    EColorRange range = V_ParseFontColor(color_id, CR_UNTRANSLATED, CR_YELLOW);
    cp = (const char *)color_id;
    if (range != CR_UNDEFINED)
    {
      // Change the color of future text added to the control.
      PalEntry color = V_LogColorFromColorRange(range);
      if (StdOut != NULL && FancyStdOut)
      {
    // Unfortunately, we are pretty limited here: There are only
    // eight basic colors, and each comes in a dark and a bright
    // variety.
    float h, s, v, r, g, b;
    WORD attrib = 0;
    RGBtoHSV(color.r / 255.f, color.g / 255.f, color.b / 255.f, &h, &s, &v);
    if (s != 0)
    { // color
      HSVtoRGB(&r, &g, &b, h, 1, 1);
      if (r == 1) attrib = FOREGROUND_RED;
      if (g == 1) attrib |= FOREGROUND_GREEN;
      if (b == 1) attrib |= FOREGROUND_BLUE;
      if (v > 0.6) attrib |= FOREGROUND_INTENSITY;
    }
    else
    { // gray
      if (v < 0.33) attrib = FOREGROUND_INTENSITY;
      else if (v < 0.90) attrib = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
      else attrib = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY;
    }
    SetConsoleTextAttribute(StdOut, attrib);
      }
      if (edit != NULL)
      {
    // GDI uses BGR colors, but color is RGB, so swap the R and the B.
    swapvalues(color.r, color.b);
    // Change the color.
    format.cbSize = sizeof(format);
    format.dwMask = CFM_COLOR;
    format.dwEffects = 0;
    format.crTextColor = color;
    SendMessage(edit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&format);
      }
    }
  }
}
No tags attached.
zip CrashReport CF.zip (51,671) 2021-10-28 21:19
https://zandronum.com/tracker/file_download.php?file_id=2666&type=bug
Issue History
2021-10-28 20:07Mr. SatanNew Issue
2021-10-28 21:19Mr. SatanFile Added: CrashReport CF.zip
2021-10-29 03:51KaminskyAssigned To => Kaminsky
2021-10-29 03:51KaminskyStatusnew => confirmed
2021-10-30 18:30KaminskyStatusconfirmed => needs review
2021-10-31 15:59KaminskyStatusneeds review => needs testing
2021-12-04 18:17KaminskyNote Added: 0021847
2021-12-04 18:17KaminskyStatusneeds testing => resolved
2021-12-04 18:17KaminskyFixed in Version => 3.1-beta
2021-12-04 18:17KaminskyResolutionopen => fixed

Notes
(0021847)
Kaminsky   
2021-12-04 18:17   
Marking this as resolved, as WaTaKiD confirmed that the crashes don't occur anymore after testing with the 32-bit and 64-bit Windows builds.