Skip to content

Commit

Permalink
encode: protect from invalid ACDBPLACEHOLDER class_id
Browse files Browse the repository at this point in the history
Fixes GH #359, a fuzzed DWG with ACDBPLACEHOLDER as 53 (STYLE)
  • Loading branch information
rurban committed Feb 6, 2022
1 parent e95cc1e commit 44c9b62
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1835,6 +1835,12 @@ dwg_encode (Dwg_Data *restrict dwg, Bit_Chain *restrict dat)
fixup = 0;
// if not found leaves placeholder_type at 0 to use DUMMY
dwg_find_class (dwg, "ACDBPLACEHOLDER", &placeholder_type);
if (placeholder_type < 500)
{
LOG_ERROR ("Invalid class_id %d for ACDBPLACEHOLDER",
(int)placeholder_type);
placeholder_type = 0;
}
for (i = 0; i < dwg->num_objects; i++)
{
Dwg_Object *obj = &dwg->object[i];
Expand Down

0 comments on commit 44c9b62

Please sign in to comment.