Skip to content

Commit

Permalink
Fix stack overflow on self-referential __index mtv
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyMorganz committed Nov 23, 2022
1 parent 2eada2f commit ff6fdf1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/LuauExt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,8 @@ std::optional<Luau::Property> lookupProp(const Luau::TypeId& parentType, const L
if (indexIt != mtable->props.end())
{
Luau::TypeId followed = Luau::follow(indexIt->second.type);
if (Luau::get<Luau::TableTypeVar>(followed) || Luau::get<Luau::MetatableTypeVar>(followed))
if ((Luau::get<Luau::TableTypeVar>(followed) || Luau::get<Luau::MetatableTypeVar>(followed)) &&
followed != parentType) // ensure acyclic
{
return lookupProp(followed, name);
}
Expand Down

0 comments on commit ff6fdf1

Please sign in to comment.