Skip to content

Cherrypick [-Wunsafe-buffer-usage] Emit a warning if pointer returned by vector::data and array::data is cast to larger type #9584

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

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

malavikasamak
Copy link

(rdar://136704278)

…:data and array::data is cast to larger type (llvm#111910)

Emit a warning when the raw pointer retrieved from std::vector and
std::array instances are cast to a larger type. Such a cast followed by
a field dereference to the resulting pointer could cause an OOB access.
This is similar to the existing span::data warning.

(rdar://136704278)

Co-authored-by: MalavikaSamak <[email protected]>
(cherry picked from commit e913a33)
@malavikasamak
Copy link
Author

@llvm-ci test

@malavikasamak
Copy link
Author

@swift-ci test

@malavikasamak malavikasamak merged commit dd02857 into stable/20240723 Nov 13, 2024
3 checks passed
@malavikasamak malavikasamak deleted the msamak-cherrypick-vector-data branch November 13, 2024 05:10
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.

1 participant