nint8835-archive/iTunesRichPresence

Songs with long artist names crashes the program.

Closed this issue · 4 comments

This seems like a rare case, but I tried playing a song with very long artist text, the the program crashes.
here's the crash log:

************** Exception Text **************

System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
at iTunesRichPresence.DiscordRPC.RichPresence.StrClampBytes(String toclamp, Int32 maxbytes)
at iTunesRichPresence.DiscordRPC.RichPresence.StrToPtr(String input, Int32 maxbytes)
at iTunesRichPresence.DiscordRPC.RichPresence.GetStruct()
at iTunesRichPresence.DiscordRPC.UpdatePresence(RichPresence presence)
at iTunesRichPresence.MainForm.UpdatePresence()
at iTunesRichPresence.MainForm.pollTimer_Tick(Object sender, EventArgs e)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Huh, the crash is actually coming from within Discord's RPC code. Any chance I could have the artist text that caused the crash? I might have to truncate the information before it gets sent off to Discord

It's " Rie Kugimiya (釘宮 理恵), Chiaki Takahashi (たかはし 智秋), Asami Shimoda (下田 麻美) & Naomi Wakabayashi (若林 直美) " without the quotes.

Sure enough, that text is over the 128 byte limit, as expected. I should be able to implement some truncation to prevent the crash from happening

@seizuresmiley Alright, I believe I have a fix for this implemented. Can you DM me the file causing the issue over Discord? I'm nint8835#0001