forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unsafe-buffer error: Handle duplicates.
Handle duplicates in opt-in/opt-out path prefixes to avoid unexpected behavior. This change normalizes the opt-in and opt-out path prefixes by sorting and removing duplicates or sub-prefixes. This ensures that adding additional opt-outs, even if redundant, does not inadvertently opt-in other targets. This is important, especially when landing concurrent patches, or revert/relanding some of them. Bug: 357649176 Change-Id: I253b38ff330d33e5053703ecafe178de91471844 Fixed: 357649176 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5796896 Commit-Queue: Arthur Sonzogni <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Cr-Commit-Position: refs/heads/main@{#1344630}
- Loading branch information
1 parent
5464de5
commit bb6f632
Showing
5 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...clang/plugins/tests/unsafe_buffers_not_clean_dir/still_not_clean_dir_1/not_clean_header.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2024 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
#ifndef TOOLS_CLANG_PLUGINS_TESTS_UNSAFE_BUFFERS_NOT_CLEAN_DIR_STILL_NOT_CLEAN_DIR_1_NOT_CLEAN_HEADER_H_ | ||
#define TOOLS_CLANG_PLUGINS_TESTS_UNSAFE_BUFFERS_NOT_CLEAN_DIR_STILL_NOT_CLEAN_DIR_1_NOT_CLEAN_HEADER_H_ | ||
|
||
inline int unchecked_violation_1(int* i, unsigned s) { | ||
return i[s]; // This is in a known-bad header, so no error is emitted. | ||
} | ||
|
||
#endif // TOOLS_CLANG_PLUGINS_TESTS_UNSAFE_BUFFERS_NOT_CLEAN_DIR_STILL_NOT_CLEAN_DIR_1_NOT_CLEAN_HEADER_H_ |
11 changes: 11 additions & 0 deletions
11
...clang/plugins/tests/unsafe_buffers_not_clean_dir/still_not_clean_dir_2/not_clean_header.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2024 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
#ifndef TOOLS_CLANG_PLUGINS_TESTS_UNSAFE_BUFFERS_NOT_CLEAN_DIR_STILL_NOT_CLEAN_DIR_2_NOT_CLEAN_HEADER_H_ | ||
#define TOOLS_CLANG_PLUGINS_TESTS_UNSAFE_BUFFERS_NOT_CLEAN_DIR_STILL_NOT_CLEAN_DIR_2_NOT_CLEAN_HEADER_H_ | ||
|
||
inline int unchecked_violation_2(int* i, unsigned s) { | ||
return i[s]; // This is in a known-bad header, so no error is emitted. | ||
} | ||
|
||
#endif // TOOLS_CLANG_PLUGINS_TESTS_UNSAFE_BUFFERS_NOT_CLEAN_DIR_STILL_NOT_CLEAN_DIR_2_NOT_CLEAN_HEADER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters