From 5aa6d9934024c92efac4e96838b2ad98589c4ed8 Mon Sep 17 00:00:00 2001 From: Vighnesh Date: Fri, 5 Apr 2024 13:27:37 -0700 Subject: [PATCH] transplant game engine fix for memory safety issues in normalization into OSS changes --- Analysis/src/TypeChecker2.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Analysis/src/TypeChecker2.cpp b/Analysis/src/TypeChecker2.cpp index c82bb6e9..b45e75b1 100644 --- a/Analysis/src/TypeChecker2.cpp +++ b/Analysis/src/TypeChecker2.cpp @@ -2631,6 +2631,9 @@ struct TypeChecker2 for (const auto& [ty, _negations] : norm->classes.classes) { fetch(ty); + + if (!normValid) + break; } } @@ -2644,9 +2647,16 @@ struct TypeChecker2 fetch(builtinTypes->stringType); if (normValid) fetch(norm->threads); - for (TypeId ty : norm->tables) - if (normValid) + if (normValid) + { + for (TypeId ty : norm->tables) + { fetch(ty); + + if (!normValid) + break; + } + } if (normValid && norm->functions.isTop) fetch(builtinTypes->functionType); else if (normValid && !norm->functions.isNever()) @@ -2672,6 +2682,9 @@ struct TypeChecker2 } else fetch(tyvar); + + if (!normValid) + break; } }