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

Edited 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:<br /><br />System.OverflowException: Arithmetic operation resulted in an overflow.<br /> at System.IntPtr.ToInt32()<br /> at NAudio.WindowsMediaFormat.NSSBuffer.Read(Byte[] buffer, Int32 offset, Int32 count)<br /> at NAudio.WindowsMediaFormat.WmaStream.Read(Byte[] buffer, Int32 offset, Int32 count)<br /><br />The change should check the system architecture and perform the correct casting to an integer type like so:<br /><br />IntPtr src;<br />if (IntPtr.Size == 8) {<br /> src = (IntPtr)(m_BufferPtr.ToInt64() + m_Position);<br />}<br />else {<br /> src = (IntPtr)(m_BufferPtr.ToInt32() + m_Position);<br />}<br /><br />I have tested this change and it does fix this exception.<br /><br />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.<br /><br />Thanks for such an amazing library. :)

Viewing all articles
Browse latest Browse all 738

Trending Articles