Yucked / Victoria

🌋 - Lavalink wrapper for Discord.NET. Provides more options and performs better than all .NET Lavalink libraries combined.
https://github.com/Yucked/Victoria/wiki
193 stars 48 forks source link

Int32 overflow when parsing track length after loading in a direct .mp3 stream #164

Closed thisRandomm closed 3 months ago

thisRandomm commented 3 months ago

Error message:

 ---> System.AggregateException: One or more errors occurred. (One or more errors occurred. (The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. LineNumber: 0 | BytePositionInLine: 0.))
 ---> System.AggregateException: One or more errors occurred. (The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. LineNumber: 0 | BytePositionInLine: 0.)
 ---> System.Text.Json.JsonReaderException: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. LineNumber: 0 | BytePositionInLine: 0.
   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb& database, StackRowStack& stack)
   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedArrayPoolBytes, PooledByteBufferWriter extraPooledByteBufferWriter)
   at System.Text.Json.JsonDocument.ParseAsyncCore(Stream utf8Json, JsonDocumentOptions options, CancellationToken cancellationToken)

Victoria debug log:

dbug: Victoria.LavaNode[0]
      {"loadType":"track","data":{"encoded":"QAAAhgMADlJhZGlvIMOWY2tlcsO2AA5SYWRpbyDDlmNrZXLDtn//////////ACFodHRwczovL3JhZGlvLmRhcnViLnNlL29ja2Vyby5tcDMBAQAhaHR0cHM6Ly9yYWRpby5kYXJ1Yi5zZS9vY2tlcm8ubXAzAAAABGh0dHAAA21wMwAAAAAAAAAA","info":{"identifier":"https://radio.darub.se/ockero.mp3","isSeekable":false,"author":"Radio Öckerö","length":9223372036854775807,"isStream":true,"position":0,"title":"Radio Öckerö","uri":"https://radio.darub.se/ockero.mp3","sourceName":"http","artworkUrl":null,"isrc":null},"pluginInfo":{"probeInfo":"mp3"},"userData":{}}}

error throws at Victoria\src\Rest\Search\SearchResponse.cs:line 43 at Victoria\src\LavaNode.cs:line 311 from LoadTrackAsync()

A possible solution would be to use TryParse() at the LavaTrack constructor/property setter, and if it fails then fallback to either Int32.MaxValue or 0

discord convo link: message

Yucked commented 3 months ago

Fixed in https://github.com/Yucked/Victoria/pull/165

Thank you @thisRandomm