Files
IfcOpenShell/src/ifcparse
Petru Conduraru c68e4a0eee Size entity attribute storage to schema arity, not token count
When a STEP instance has fewer attribute tokens than its schema declares
(commonly from corrupted/malformed syntax), parse_context::construct()
sized the in-memory attribute storage to the smaller token count instead
of the schema's attribute count. This left the storage's last N attribute
slots simply nonexistent rather than blank, so any later read of one of
those trailing attributes by index threw an uncaught IfcParse::IfcException
("Index N is out of range for storage of size N") that terminated the
whole process (SIGABRT) instead of being handled as a parse warning.

Fix: when the schema declaration is known, size the storage to the
schema's attribute count. Indices beyond the number of tokens found are
left at their existing default-constructed blank value (the storage
constructor already blank-initializes every slot), so a truncated
instance now degrades to blank values for its missing trailing
attributes, matching the parser's existing "expected N attribute values,
found M" warning intent instead of crashing.

Reproduced with the fuzzing script attached to #5679: single-byte
mutations of a minimal IFC4 file that corrupt the IFCPROJECT instance's
token stream reliably aborted IfcConvert with this exact exception before
the fix, and now parse with a logged syntax error and exit code 0.

Fixes #5679

Generated with the assistance of an AI coding tool.
2026-07-19 10:29:48 +02:00
..
2025-12-22 18:44:42 +05:00
2026-06-11 21:09:56 +02:00
2026-06-11 21:09:56 +02:00
2026-06-11 21:09:56 +02:00
2026-06-11 21:09:56 +02:00
2026-06-11 21:09:56 +02:00
2026-06-11 21:09:56 +02:00
2026-06-11 21:09:56 +02:00
2026-06-11 21:09:56 +02:00
2026-06-11 21:09:56 +02:00
2026-06-24 11:12:21 +02:00
2026-06-12 11:04:18 +02:00
2026-06-11 21:09:56 +02:00