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

libuvc: fix undefined behavior caused by capture-by-reference of local variable #3783

Conversation

WasabiFan
Copy link
Contributor

"&" captures all used variables by reference; as mentioned in this Stack Overflow question, that causes undefined behavior if the lambda is invoked after the function's stack frame is deallocated.

This means that the child thread was dereferencing a pointer from the other thread's stack frame -- sometimes it would happen to work because that data was still there, and other times it wouldn't and the process would segfault.

It appears this was introduced in 9d17956.

@dorodnic
Copy link
Contributor

Thanks @WasabiFan @radfordi

@dorodnic dorodnic merged commit d353193 into IntelRealSense:development Apr 28, 2019
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.

3 participants