Skip to content

Commit 9962f79

Browse files
committed
[RemoteMirror] Fix potential uninitialized data access in convertChild.
The else branch of the type checking code just does assert(false). When asserts are off, the code will fall through and access the uninitialized FieldInfo variable. Instead, return something sensible for this error case.
1 parent 9bc2819 commit 9962f79

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

stdlib/public/SwiftRemoteMirror/SwiftRemoteMirror.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,12 @@ static swift_childinfo_t convertChild(const TypeInfo *TI, unsigned Index) {
447447
FieldInfo = &(RecordTI->getFields()[Index]);
448448
} else {
449449
assert(false && "convertChild(TI): TI must be record or enum typeinfo");
450+
return {
451+
"unknown TypeInfo kind",
452+
0,
453+
SWIFT_UNKNOWN,
454+
0,
455+
};
450456
}
451457

452458
return {

0 commit comments

Comments
 (0)