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

Access out of scope fix in OCLToSPIRVBase::transBuiltin #2262

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

bwlodarcz
Copy link
Contributor

@bwlodarcz bwlodarcz commented Dec 12, 2023

OldRetTy pointer was passed to lambda by reference. This means that in lambda it's real C-like type was Value ** pointing to the stack within of the transBuiltin stack frame. Logic of lambda is executed in doConversion function executed in destructor of BuiltinCallMutator. The stack frame is inaccessible during the destructor call and it worked only as undefined behavior's.
Fix clears some ASan errors from issue #2233.

@VyacheslavLevytskyy
Copy link
Contributor

LGTM, nice finding @bwlodarcz

Copy link
Contributor

@asudarsa asudarsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall.

Thanks

Copy link
Contributor

@vmaksimo vmaksimo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one nit

lib/SPIRV/OCLToSPIRV.cpp Outdated Show resolved Hide resolved
OldRetTy pointer was passed to lambda by reference. This means that
in lambda it's real C-like type was Value ** pointing to the stack
within of the transBuiltin stack frame. Logic of lambda is executed in
doConversion function executed in destructor of BuiltinCallMutator.
The stack frame is unaccessible during the destructor call and
it worked only as undfined behaviour.
@vmaksimo vmaksimo merged commit 85a10e2 into KhronosGroup:main Dec 14, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants