mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-18 07:57:31 +08:00
0031292: Data Exchange - SIGSEGV on reading STEP file with references to invalid entities
Changes: - in StepData_StepReaderData::ReadEntity, make sure that entity handle is not null before calling IsKind() of it. - in StepData_StepReaderData::SetEntityNumbers, do not invert the sign of entity number of referenced parameter if the second pass is not required. Otherwise, the number -1 (obviously invalid) becomes 1 (invalid, but not obviously) without further correction of it. - in StepData_UndefinedEntity::ReadRecord, consider the case when the entity number is positive but refers to non-existing entity. In this case literal value will be used instead of null entity for the problematic parameter.
This commit is contained in:
@@ -67,13 +67,16 @@ void StepData_UndefinedEntity::ReadRecord(const Handle(StepData_StepReaderData)&
|
||||
Standard_Integer nume = 0;
|
||||
if (partyp == Interface_ParamIdent) {
|
||||
nume = SR->ParamNumber(num,i);
|
||||
if (nume > 0) {
|
||||
anent = SR->BoundEntity(nume);
|
||||
if (anent.IsNull()) {
|
||||
nume = 0;
|
||||
}
|
||||
}
|
||||
if (nume <= 0) {
|
||||
ach->AddFail("A reference to another entity is unresolved");
|
||||
partyp = Interface_ParamVoid;
|
||||
}
|
||||
else {
|
||||
anent = SR->BoundEntity(nume);
|
||||
}
|
||||
}
|
||||
else if (partyp == Interface_ParamSub) {
|
||||
nume = SR->ParamNumber(num,i);
|
||||
|
||||
Reference in New Issue
Block a user