Skip to content

osu://edit/ editor timestamp links with hit objects crash chat #25614

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

Closed
Susko3 opened this issue Nov 30, 2023 · 5 comments
Closed

osu://edit/ editor timestamp links with hit objects crash chat #25614

Susko3 opened this issue Nov 30, 2023 · 5 comments

Comments

@Susko3
Copy link
Member

Susko3 commented Nov 30, 2023

Type

Crash to desktop

Bug description

Editor timestamp link that are posted in full (osu://edit/xx:yy:zzz (u,v,...)) will throw unexpected exceptions when posted in chat.

First reported in https://discord.com/channels/188630481301012481/1097318920991559880/1179770517994078248.

Repro branch https://github.com/ppy/osu/compare/master...Susko3:fix-chat-editor-timestamps?expand=1, failing test commit: 8d02745

This commit adds the following test string which will generate two overlapping OpenEditorTimestamp links.

osu://edit/00:12:345 (1,2) - Test?
^------------------^		first OpenEditorTimestamp
           ^-------------^	second OpenEditorTimestamp

The overlapping links break the logic here: (this tries to add the text in between the links – text of negative length)

AddText(text[previousLinkEnd..link.Index]);


I'm not sure what's the expected outcome when the parser is given the string osu://edit/00:12:345 (1,2). Possible outcomes:

Parsed text with link OpenEditorTimestamp argument Notes
osu://edit/00:12:345 (1,2) 00:12:345 (1,2) Makes the most sense, except spaces in the URL
osu://edit/00:12:345 (1,2) 00:12:345 (1,2)  
osu://edit/00:12:345 (1,2) 00:12:345

Keep in mind that osu://edit/00:12:345%20(1,2) in chat only partially works, it'll move to the requested timestamp, but won't select any objects.

Screenshots or videos

The parsed links in the failing test:

image

Version

b2e1a63

Logs

2023-11-30 14:06:57 [error]: An unhandled error has occurred.
2023-11-30 14:06:57 [error]: System.ArgumentOutOfRangeException: Length cannot be less than zero. (Parameter 'length')
2023-11-30 14:06:57 [error]: at System.String.Substring(Int32 startIndex, Int32 length)
2023-11-30 14:06:57 [error]: at osu.Game.Graphics.Containers.LinkFlowContainer.AddLinks(String text, List`1 links) in C:\...\osu\osu.Game\Graphics\Containers\LinkFlowContainer.cs:line 50
2023-11-30 14:06:57 [error]: at osu.Game.Overlays.Chat.ChatLine.updateMessageContent() in C:\...\osu\osu.Game\Overlays\Chat\ChatLine.cs:line 215
2023-11-30 14:06:57 [error]: at osu.Game.Overlays.Chat.ChatLine.LoadComplete() in C:\...\osu\osu.Game\Overlays\Chat\ChatLine.cs:line 155
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Drawable.loadComplete()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Drawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Testing.TestBrowser.ErrorCatchingDelayedLoadWrapper.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
2023-11-30 14:06:57 [error]: at osu.Framework.Platform.GameHost.UpdateFrame()
2023-11-30 14:06:57 [error]: at osu.Framework.Threading.GameThread.processFrame()
@ppy-sentryintegration
Copy link

Sentry issue: OSU-TS2

@Loreos7
Copy link
Contributor

Loreos7 commented Nov 30, 2023

For me the game is being crashed by posting timestamp link in chat:
network.log
runtime.log
performance.log
updater.log

@RatinFX
Copy link
Contributor

RatinFX commented Nov 30, 2023

It also happens when you type osu://xx:yy:zzz, it seems like advanced_link_regex adds it to the links at

handleAdvanced(advanced_link_regex, result, startIndex);

image

Unless it's used somewhere, I would expect the parser to just ignore anything osu:// when it was said in the in-game chat

@Susko3
Copy link
Member Author

Susko3 commented Nov 30, 2023

using osu:// urls in chat is tested, so I assume it's important

addMessageWithChecks($"Join my [#english]({OsuGameBase.OSU_PROTOCOL}chan/#english).", 1, expectedActions: LinkAction.OpenChannel);
addMessageWithChecks($"Join my {OsuGameBase.OSU_PROTOCOL}chan/#english.", 1, expectedActions: LinkAction.OpenChannel);
addMessageWithChecks($"Join my{OsuGameBase.OSU_PROTOCOL}chan/#english.", 1, expectedActions: LinkAction.OpenChannel);

@bdach
Copy link
Collaborator

bdach commented Dec 2, 2023

I'm closing the issue as the crash is fixed. Supporting the other timestamp link syntax can be tracked separately.

@bdach bdach closed this as completed Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants