Skip to content

Commit 88fc183

Browse files
committed
json: protect from NULL or wrong _obj
fatal. Thanks to 7erryX (GH #1190)
1 parent 0bd1d34 commit 88fc183

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/out_json.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,6 +2094,11 @@ json_tables_write (Bit_Chain *restrict dat, Dwg_Data *restrict dwg)
20942094
Dwg_Object *obj = &dwg->object[num + i];
20952095
Dwg_Object_BLOCK_HEADER *_obj
20962096
= obj->tio.object->tio.BLOCK_HEADER;
2097+
if (!_obj || obj->fixedtype != DWG_TYPE_BLOCK_HEADER)
2098+
{
2099+
LOG_ERROR ("Missing BLOCK_HEADER object at [%u]\n", num + i);
2100+
return DWG_ERR_CRITICAL;
2101+
}
20972102
PRE (R_13b1)
20982103
{
20992104
if (strEQc (_obj->name, "*MODEL_SPACE"))

0 commit comments

Comments
 (0)