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

[SR-15613] Local variable prematurely freed in release builds #57909

Open
stackotter opened this issue Dec 17, 2021 · 0 comments
Open

[SR-15613] Local variable prematurely freed in release builds #57909

stackotter opened this issue Dec 17, 2021 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@stackotter
Copy link

Previous ID SR-15613
Radar None
Original Reporter @stackotter
Type Bug

Attachment: Download

Environment

macOS 12.0.1

MacBook Air, Dual-Core Intel Core i5

Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)

Xcode Version 13.2 (13C90)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 08445327acee57f1911ce291bc9b1475

Issue Description:

The method is quite big so I'll instead link the offending file: https://github.com/stackotter/delta-client/blob/04d2e93c0aa11b12c7a297a1c30537ccc602161c/Sources/Core/Sources/Render/Entity/EntityRenderer.swift. The offending method is `EntityRenderer.render`. The code crashes at lines 101 and 110 (depending on which branch is taken) with a use-after-free of the local variable `entityUniforms`.

This crash only occurs in release builds, which leads me to believe that the crash is something to do with an optimisation that is prematurely freeing `entityUniforms`.

If I insert `print(entityUniforms.count)` at line 112 (to force the compiler to let the variable live long enough), the crash no longer occurs.

I have attached the report generated by address sanitiser. If any more information is required I would happy to provide it.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

1 participant