Skip to content
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

throw System.IndexOutOfRangeException #25

Open
MikiraSora opened this issue Jul 8, 2023 · 2 comments
Open

throw System.IndexOutOfRangeException #25

MikiraSora opened this issue Jul 8, 2023 · 2 comments

Comments

@MikiraSora
Copy link

System.IndexOutOfRangeException
  HResult=0x80131508
  Message=索引超出了数组界限。
  Source=MP3Sharp
  StackTrace:
   at MP3Sharp.Decoding.Decoders.LayerI.SubbandLayer1.ReadAllocation(Bitstream stream, Header header, Crc16 crc) in C:\Users\mikir\Source\Repos\MP3Sharp\MP3Sharp\Decoding\Decoders\LayerI\SubbandLayer1.cs:line 69
   at MP3Sharp.Decoding.Decoders.LayerIDecoder.ReadAllocation() in C:\Users\mikir\Source\Repos\MP3Sharp\MP3Sharp\Decoding\Decoders\LayerIDecoder.cs:line 87
   at MP3Sharp.Decoding.Decoders.LayerIDecoder.DecodeFrame() in C:\Users\mikir\Source\Repos\MP3Sharp\MP3Sharp\Decoding\Decoders\LayerIDecoder.cs:line 47
   at MP3Sharp.Decoding.Decoder.DecodeFrame(Header header, Bitstream stream) in C:\Users\mikir\Source\Repos\MP3Sharp\MP3Sharp\Decoding\Decoder.cs:line 134
   at MP3Sharp.MP3Stream.ReadFrame() in C:\Users\mikir\Source\Repos\MP3Sharp\MP3Sharp\MP3Stream.cs:line 246
   at MP3Sharp.MP3Stream.Read(Byte[] buffer, Int32 offset, Int32 count) in C:\Users\mikir\Source\Repos\MP3Sharp\MP3Sharp\MP3Stream.cs:line 201
   at ConsoleApp1.Program.Main(String[] args) in C:\Users\mikir\source\repos\MP3Sharp\ConsoleApp1\Program.cs:line 22

Test code Program.cs

using MP3Sharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            using var stream = new MP3Stream(@"F:\track.mp3");
            // Create the buffer.
            var buffer = new byte[4096];
            // read the entire mp3 file.
            int bytesReturned = 1;
            int totalBytesRead = 0;
            while (bytesReturned > 0)
            {
                bytesReturned = stream.Read(buffer, 0, buffer.Length);
                totalBytesRead += bytesReturned;
            }
            // close the stream after we're done with it.
            stream.Close();
        }
    }
}

track.zip

@MikiraSora
Copy link
Author

MikiraSora commented Jul 8, 2023

hmmm, Is there any way to "ignore" this exception and continue provide sample data?

@commandhat
Copy link

commandhat commented Oct 27, 2023

Coming in here to throw a "me too" at this problem. Just encountered what appears to be a similar issue in a dependent program.

Here's my problematic track. (1.54MB zipped)

Stacktrace from the linked repository above:

   at XPT.Core.Audio.MP3Sharp.Decoding.Decoders.LayerI.SubbandLayer1Stereo.ReadAllocation(Bitstream stream, Header header, Crc16 crc)
   at XPT.Core.Audio.MP3Sharp.Decoding.Decoders.LayerIDecoder.ReadAllocation()
   at XPT.Core.Audio.MP3Sharp.Decoding.Decoders.LayerIDecoder.DecodeFrame()
   at XPT.Core.Audio.MP3Sharp.Decoding.Decoder.DecodeFrame(Header header, Bitstream stream)
   at XPT.Core.Audio.MP3Sharp.MP3Stream.ReadFrame()
   at XPT.Core.Audio.MP3Sharp.MP3Stream.set_Position(Int64 value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants