Skip to content
Permalink
Browse files Browse the repository at this point in the history
add DEBUGGING_CLASS_CPP
and use it for TABLECONTENT.
This is more stable than CLASS_DXF in cases when
TABLE is mixed up with TABLECONTENT. See e.g.
GH #178, where it fixes the heap_overflow2 case.
  • Loading branch information
rurban committed Jan 2, 2020
1 parent d2d72fc commit f878ba6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
16 changes: 15 additions & 1 deletion src/classes.inc
Expand Up @@ -53,10 +53,12 @@
# define DEBUGGING_DXF(action, name) ALLOW_DXF(action, name)
# define DEBUGGING_CLASS(action, name) UNSTABLE_CLASS(action, name)
# define DEBUGGING_CLASS_DXF(action, name, _dxfname) UNSTABLE_CLASS_DXF(action, name, _dxfname)
# define DEBUGGING_CLASS_CPP(action, name, cppname) UNSTABLE_CLASS_CPP(action, name, cppname)
#else
# define DEBUGGING_DXF(action, name) DISALLOW_DXF(action, name)
# define DEBUGGING_CLASS(action, name) UNHANDLED_CLASS(action, name)
# define DEBUGGING_CLASS_DXF(action, name, _dxfname) UNHANDLED_CLASS_DXF(action, name, _dxfname)
# define DEBUGGING_CLASS_CPP(action, name, cppname) UNHANDLED_CLASS_CPP(action, name, cppname)
#endif

//#define _DWG_FUNC_N(action,name) dwg_ ## action ## _ ## name
Expand Down Expand Up @@ -149,6 +151,18 @@
/* return dwg_##action_##name(dat, obj); */ \
return DWG_ERR_UNHANDLEDCLASS; \
}
#define UNHANDLED_CLASS_CPP(action, _name, _cppname) \
if (klass->cppname && strEQc (klass->cppname, #_cppname)) \
{ \
WARN_UNHANDLED_CLASS; \
if (strEQc (_STR(action), "decode") || !memcmp (_STR(action), "in", 2)) { \
obj->name = (char*) #_name; \
obj->dxfname = (char*) #_name; \
obj->fixedtype = DWG_TYPE_##_name; \
} \
/* return dwg_##action_##name(dat, obj); */ \
return DWG_ERR_UNHANDLEDCLASS; \
}

/* Entities */
STABLE_CLASS (ACTION, CAMERA) /*ent, not persistent in a DWG */
Expand Down Expand Up @@ -220,7 +234,7 @@
DEBUGGING_CLASS (ACTION, SWEPTSURFACE) /*ent */
DEBUGGING_CLASS_DXF (ACTION, TABLE, ACAD_TABLE) /*ent, r2010+ needs subclassing */
DEBUGGING_CLASS (ACTION, ARC_DIMENSION) //ent
DEBUGGING_CLASS (ACTION, TABLECONTENT) //wrong values
DEBUGGING_CLASS_CPP (ACTION, TABLECONTENT, AcDbTableContent)
DEBUGGING_CLASS (ACTION, TABLEGEOMETRY) //wrong geom_data
DEBUGGING_CLASS (ACTION, CELLSTYLEMAP) //broken
DEBUGGING_CLASS (ACTION, MATERIAL) //working on
Expand Down
4 changes: 2 additions & 2 deletions src/dec_macros.h
Expand Up @@ -1236,8 +1236,8 @@
obj_dat = *dat; \
hdl_dat = *dat; \
str_dat = *dat; \
error \
= dwg_decode_##token##_private (&obj_dat, &hdl_dat, &str_dat, obj); \
error = dwg_decode_##token##_private (&obj_dat, &hdl_dat, &str_dat, \
obj); \
} \
else { error = dwg_decode_##token##_private (dat, dat, dat, obj); } \
return error; \
Expand Down

0 comments on commit f878ba6

Please sign in to comment.