Quantcast
Channel: naudio Work Item Rss Feed
Viewing all articles
Browse latest Browse all 738

Created Issue: NAudio.WindowsMediaFormat.NSSBuffer IntPtr.ToInt32() OverflowException [16379]

$
0
0
Please change the NAudio.WindowsMediaFormat.NSSBuffer class Read and Write methods. Under load you will get an OverflowException such as this:

System.OverflowException: Arithmetic operation resulted in an overflow.
at System.IntPtr.ToInt32()
at NAudio.WindowsMediaFormat.NSSBuffer.Read(Byte[] buffer, Int32 offset, Int32 count)
at NAudio.WindowsMediaFormat.WmaStream.Read(Byte[] buffer, Int32 offset, Int32 count)

The change should check the system architecture and perform the correct casting to an integer type like so:

IntPtr src;
if (IntPtr.Size == 8) {
src = (IntPtr)(m_BufferPtr.ToInt64() + m_Position);
}
else {
src = (IntPtr)(m_BufferPtr.ToInt32() + m_Position);
}

I have tested this change and it does fix this exception.

Please see MSDN at http://msdn.microsoft.com/en-us/library/system.intptr.toint32.aspx for details on this exception as it reads: OverflowExceptions will occur on a 64-bit platform. The value of this instance may be too large or too small to be represented as a 32-bit signed integer.

Thanks for such an amazing library. :)

Viewing all articles
Browse latest Browse all 738

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>