Repository navigation
Fix bugs found by an ASan, UBSan and TSan sweep #462
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
Open
failaip12
wants to merge
13
commits into
Eglantine-Community:nx2
Choose a base branch
from
cira0100:fix/sanitizer-findings
base: nx2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+167
−34
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d43b3d2
dynarmic: pack both halves in the AVX-512 16-bit vector CLZ
failaip12 4c0cbe1
audio_core: add renderer systems under the list lock
failaip12 ecd4e0f
video_core: destroy the renderer before the GPU channels
failaip12 d1f6ead
video_core: track exact 64-byte units in the buffer usage tracker
failaip12 ea2a03a
core, common: fix data races in timing, perf stats and file logging
failaip12 e356a50
input_common: take the SDL joystick lock before the joystick map lock
failaip12 1479241
hid_core: skip unassigned applet slots in the button handler
failaip12 6375dc4
audio_core, core, common: fix UB found by UBSan and an out-of-bounds …
failaip12 8754859
core: make the exit lock, exit request and NVDEC flags atomic
failaip12 9932bd6
tests: cover the buffer usage tracker masks and VectorVfsFile reads
failaip12 131a342
core: publish the pause end time before resuming the timer
failaip12 29d5d78
Merge branch 'nx2' into fix/sanitizer-findings
failaip12 f3a689d
Merge upstream nx2 into fix/sanitizer-findings
failaip12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,25 @@ | ||
| // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project | ||
| // SPDX-License-Identifier: GPL-3.0-or-later | ||
|
|
||
| #include <array> | ||
| #include <vector> | ||
|
|
||
| #include <catch2/catch_test_macros.hpp> | ||
|
|
||
| #include "core/file_sys/vfs/vfs_vector.h" | ||
|
|
||
| namespace { | ||
| TEST_CASE("VectorVfsFile reads stop at the end of the data", "[core][vfs]") { | ||
| const FileSys::VectorVfsFile file(std::vector<u8>{1, 2, 3, 4}); | ||
| std::array<u8, 8> out{}; | ||
|
|
||
| REQUIRE(file.Read(out.data(), out.size(), 2) == 2); | ||
| REQUIRE(out[0] == 3); | ||
| REQUIRE(out[1] == 4); | ||
| REQUIRE(file.Read(out.data(), out.size(), 4) == 0); | ||
| REQUIRE(file.Read(out.data(), out.size(), 100) == 0); | ||
|
|
||
| const FileSys::VectorVfsFile empty; | ||
| REQUIRE(empty.Read(out.data(), out.size(), 0) == 0); | ||
| } | ||
| } // namespace |
This file contains hidden or 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,50 @@ | ||
| // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project | ||
| // SPDX-License-Identifier: GPL-3.0-or-later | ||
|
|
||
| #include <catch2/catch_test_macros.hpp> | ||
|
|
||
| #include "video_core/buffer_cache/usage_tracker.h" | ||
|
|
||
| namespace { | ||
| using VideoCommon::UsageTracker; | ||
|
|
||
| TEST_CASE("UsageTracker covers partly used 64-byte units", "[video_core][usage_tracker]") { | ||
| UsageTracker tracker(1 << 20); | ||
| tracker.Track(0, 100); | ||
| REQUIRE(tracker.IsUsed(0, 1)); | ||
| REQUIRE(tracker.IsUsed(64, 16)); | ||
| REQUIRE(tracker.IsUsed(96, 4)); | ||
| REQUIRE_FALSE(tracker.IsUsed(128, 64)); | ||
|
|
||
| tracker.Reset(); | ||
| tracker.Track(60, 8); | ||
| REQUIRE(tracker.IsUsed(0, 4)); | ||
| REQUIRE(tracker.IsUsed(64, 4)); | ||
| REQUIRE_FALSE(tracker.IsUsed(128, 4)); | ||
| } | ||
|
|
||
| TEST_CASE("UsageTracker does not mark a whole page for small ranges", "[video_core][usage_tracker]") { | ||
| UsageTracker tracker(1 << 20); | ||
| tracker.Track(4096 + 128, 16); | ||
| REQUIRE(tracker.IsUsed(4096 + 128, 16)); | ||
| REQUIRE_FALSE(tracker.IsUsed(4096 + 256, 64)); | ||
| REQUIRE_FALSE(tracker.IsUsed(4096, 64)); | ||
|
|
||
| // A range ending on a page boundary marks nothing in the next page. | ||
| tracker.Reset(); | ||
| tracker.Track(4096 - 64, 64); | ||
| REQUIRE(tracker.IsUsed(4096 - 64, 64)); | ||
| REQUIRE_FALSE(tracker.IsUsed(4096, 64)); | ||
| REQUIRE_FALSE(tracker.IsUsed(4096 + 2048, 64)); | ||
| } | ||
|
|
||
| TEST_CASE("UsageTracker spans pages", "[video_core][usage_tracker]") { | ||
| UsageTracker tracker(1 << 20); | ||
| tracker.Track(4096 - 32, 4096 + 64); | ||
| REQUIRE(tracker.IsUsed(4096 - 32, 1)); | ||
| REQUIRE(tracker.IsUsed(4096 + 1024, 1)); | ||
| REQUIRE(tracker.IsUsed(2 * 4096, 16)); | ||
| REQUIRE_FALSE(tracker.IsUsed(2 * 4096 + 64, 64)); | ||
| REQUIRE_FALSE(tracker.IsUsed(0, 64)); | ||
| } | ||
| } // namespace |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.