1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 12:47:25 +08:00
osu-lazer/osu.Game
Bartłomiej Dach 995338029c
Fix difficulty cache lookups sharing underlying mod instances
`DifficultyCacheLookup`s were storing raw `Mod` instances into their
`OrderedMods` field. This could cause the cache lookups to wrongly
succeed in cases of mods with settings. The particular case that
triggered this fix was Difficulty Adjust.

Because the difficulty cache is backed by a dictionary, there are two
stages to the lookup; first `GetHashCode()` is used to find the
appropriate hash bucket to look in, and then items from that hash bucket
are compared against the key being searched for via the implementation
of `Equals()`.

As it turns out, the first hashing step ended up being the saving grace
in most cases, as the hash computation included the values of the mod
settings. But the Difficulty Adjust failure case was triggered by the
quirk that `GetHashCode(0) == GetHashCode(null) == 0`.

In such a case, the `Equals()` fallback was used. But as it turns out,
because the `Mod` instance stored to lookups was not cloned and
therefore potentially externally mutable, it could be polluted after
being stored to the dictionary, and therefore breaking the equality
check. Even though all of the setting values were compared, the hash
bucket didn't match the actual contents of the lookup anymore (because
they were mutated externally, e.g. by the user changing the mod setting
values in the mod settings overlay).

To resolve, clone out the mod structure before creating all difficulty
lookups.
2021-08-21 15:50:33 +02:00
..
Audio Update with framework changes 2021-07-28 21:54:11 +09:00
Beatmaps Fix difficulty cache lookups sharing underlying mod instances 2021-08-21 15:50:33 +02:00
Collections Schedule callback instead 2021-06-23 21:26:52 +09:00
Configuration Add a note against OsuSetting 2021-08-16 16:59:59 +09:00
Database Attempt to reduce skin lookup overhead where file access is not required 2021-08-17 00:23:30 +09:00
Extensions Update incorrect xmldoc 2021-07-31 16:48:45 +09:00
Graphics Merge branch 'master' into settings-dim-other-sections 2021-08-20 20:22:22 +09:00
Input Allow toggling focus via binding 2021-08-19 14:19:59 +09:00
IO Fix storage wrapping logic setting logger too early in startup sequence 2021-07-09 13:18:49 +09:00
IPC Apply ConfigureAwait changes to game side 2021-03-08 14:36:35 +09:00
Localisation Merge branch 'master' into localisation-settings 2021-08-16 15:41:50 +08:00
Migrations Add database tracking of beatmap creator user_ids 2021-05-14 15:40:29 +09:00
Online Merge branch 'master' into fix-messagepack-union 2021-08-20 16:01:04 +09:00
Overlays Merge branch 'master' into fix-setting-section-clickability 2021-08-21 14:11:55 +03:00
Performance Add LocalUserPlayInfo interface to convey common information about player status 2021-08-17 16:15:47 +09:00
Properties
Replays Add deep cloning support to Score/ScoreInfo/Replay 2021-07-19 14:14:28 +09:00
Rulesets Remove leftover unused using 2021-08-19 07:17:43 +03:00
Scoring Update mapper usages with LocalisableDescription 2021-07-31 01:47:14 +03:00
Screens Use the UI mouse cursor when hovering gameplay chat in an interactive state 2021-08-21 14:44:54 +09:00
Skinning Trim redundant default argument value 2021-08-17 23:00:10 +02:00
Storyboards Default DrawableStoryboard to a completed state to avoid state change on empty storyboards 2021-06-18 16:08:49 +09:00
Tests Merge branch 'master' into temporary-directory-test-storage 2021-08-20 20:41:54 +09:00
Updater Don't consider version suffixes when checking for updates 2021-07-20 01:05:37 +09:00
Users Add hover+select sounds to some components that are missing them 2021-07-30 21:35:28 +09:00
Utils Remove unnecessary "in" keyword 2021-08-09 20:53:02 +10:00
.editorconfig Add localisation license header to editorconfig 2021-08-02 11:44:10 +09:00
osu!.res
osu.Game.csproj Update resources 2021-08-20 23:47:35 +09:00
OsuGame.cs Add LocalUserPlayInfo interface to convey common information about player status 2021-08-17 16:15:47 +09:00
OsuGameBase_Importing.cs Move import logic out to partial class 2021-05-28 02:44:44 +09:00
OsuGameBase.cs Fix stack overflow in ruleset change rejection logic 2021-07-30 01:54:30 +09:00
PerformFromMenuRunner.cs Add flow to allow MatchSubScreen to handle beatmap presentation locally 2021-03-03 14:13:51 +09:00