Applied patch from Darryl Miles that prevents a segfault on an

error in "extresist".  The underlying error still exists and
causes a "Bad Device" error but no longer crashes magic.  See
github Issue #353.
This commit is contained in:
Tim Edwards 2024-12-26 16:39:23 -05:00
parent df19d62f51
commit f80540af46
2 changed files with 14 additions and 2 deletions

View File

@ -55,6 +55,13 @@ ResNewSDDevice(tile, tp, xj, yj, direction, PendingList)
tileJunk *j;
newnode = FALSE;
/* Watch for invalid client data. If found, a "Bad Device" error will
* be generated which means "more debugging needed"; however, it will
* not cause a segmentation violation.
*/
if (tp->ti_client == CLIENTDEFAULT) return;
j = (tileJunk *) tp->ti_client;
resDev = j->deviceList;
if ((j->sourceEdge & direction) != 0)

View File

@ -1725,7 +1725,12 @@ ResGetDevice(pt, type)
return (((tileJunk *)tile->ti_client)->deviceList);
}
else if (TTMaskHasType(&ExtCurStyle->exts_deviceMask, TiGetType(tile)))
return (((tileJunk *)tile->ti_client)->deviceList);
{
/* Failure to have a valid client data will result in a "Bad Device"
* error and indicates a problem that needs debugging.
*/
if (tile->ti_client != CLIENTDEFAULT)
return (((tileJunk *)tile->ti_client)->deviceList);
}
return NULL;
}