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

[🍒][-Wunsafe-buffer-usage] Warning unsafe libc calls #9287

Open
wants to merge 6 commits into
base: stable/20240723
Choose a base branch
from

Conversation

ziqingluo-90
Copy link

cherry-picked from swiftlang/llvm-project/next

@ziqingluo-90
Copy link
Author

@swift-ci test

@ziqingluo-90
Copy link
Author

I somehow can't find @jkorous-apple in the reviewer list.

@haoNoQ
Copy link

haoNoQ commented Sep 19, 2024

I somehow can't find @jkorous-apple in the reviewer list.

Doesn't work for me either hmm.

@jkorous-apple
Copy link

Weird, I am here 🤷
So, do IIUC we want to hold-off merging this until we land the changes VendorOverrides internally?

@ziqingluo-90
Copy link
Author

Weird, I am here 🤷 So, do IIUC we want to hold-off merging this until we land the changes VendorOverrides internally?

yeah, that works the best.

ziqingluo-90 and others added 6 commits September 19, 2024 14:09
[-Wunsafe-buffer-usage] Add warn on unsafe calls to libc functions

Warning about calls to libc functions involving buffer access.  Warned
functions are hardcoded by names.

(rdar://117182250)

(cherry picked from commit 0fffdeb)
This reverts commit 0fffdeb.

Will re-land this commit soon with a way to opt-out

(cherry picked from commit 2345796)
Revert commit 2345796, and re-land
with a new flag "-Wunsafe-buffer-usage-in-libc-call" for the new
warning.

(rdar://117182250)

(cherry picked from commit d7dd2c4)
…1583)"

The commit d7dd2c4 crashes for such
an example:
```
void printf() { printf(); }
```
Because it assumes `printf` must have arguments. This commit fixes
this issue.

(rdar://117182250)

(cherry picked from commit de88d7d)
…n libc warnings (llvm#108308)

For `snprintf(a, sizeof a, ...)`, the first two arguments form a safe
pattern if `a` is a constant array. In such a case, this commit will
suppress the warning.

(rdar://117182250)

(cherry picked from commit ebf25d9)
… Warning Libc functions (llvm#101583)"

StringLiteral::getString() is not applicable to strings of wide
characters.  Added handling for that.

(rdar://117182250)

(cherry picked from commit 48498ec)
@ziqingluo-90
Copy link
Author

Rebased, and @swift-ci test

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