From ff6fdf1b9b1bbfff63c304a803003cd007b2b2b1 Mon Sep 17 00:00:00 2001 From: JohnnyMorganz Date: Wed, 23 Nov 2022 19:00:16 +0000 Subject: [PATCH] Fix stack overflow on self-referential __index mtv --- CHANGELOG.md | 4 ++++ src/LuauExt.cpp | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dfbcc8d..38584cca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Fixed + +- Fixed stack overflow when looking up properties on a table type where the `__index` is set to itself + ## [1.14.0] - 2022-11-13 ### Added diff --git a/src/LuauExt.cpp b/src/LuauExt.cpp index 245f7467..8fb40a19 100644 --- a/src/LuauExt.cpp +++ b/src/LuauExt.cpp @@ -687,7 +687,8 @@ std::optional lookupProp(const Luau::TypeId& parentType, const L if (indexIt != mtable->props.end()) { Luau::TypeId followed = Luau::follow(indexIt->second.type); - if (Luau::get(followed) || Luau::get(followed)) + if ((Luau::get(followed) || Luau::get(followed)) && + followed != parentType) // ensure acyclic { return lookupProp(followed, name); }