Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assigning resource properties to setup a cyclical dependency can lead to a crash #41111

Open
Phischermen opened this issue Aug 7, 2020 · 1 comment

Comments

@Phischermen
Copy link
Contributor

Godot version:
Godot 3.2.3 rc3

OS/device including version:

Windows

Issue description:

While editing a resource, I mis-clicked and accidentally assigned the wrong file to the script property. This file happened to be the resource I was editing in the inspector. I got a warning telling me that the type was not expected. Immediately afterwards, the engine froze and crashed.

I did some debugging and discovered that the crash was caused by a stack overflow exception. This happened because the program was trying to hash the resource in a recursive method (Resource::hash_edited_version) that required the hash of the same resource. I also discovered that setting resource properties to create a cyclical dependency causes the engine to freeze and then crash. I expected the editor to prevent the user from setting up cyclical dependencies in resources, due to its instability.

Steps to reproduce:

Crash 1 - Setting script to self

  1. Download sample project
  2. Open test_resource1.tres
  3. Set script to "test_resource1.tres"
  4. A warning will popup, and then the editor will crash

Crash 2 - Creating cyclical dependency

  1. Download sample project
  2. Open test_resource2.tres
  3. Set property named "Crash" to test_resource3.tres
  4. Open test_resource3.tres
  5. Set property named "Crash" to test_resource2.tres
  6. Editor will freeze and eventually crash

Minimal reproduction project:

ResourceCyclicalDependencyIssue.zip

@Calinou
Copy link
Member

Calinou commented Mar 29, 2021

See also #44195 and #39153.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants