[Mono-bugs] [Bug 683712] New: DataConverter.Unpack reads a double when float is speficied
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Mar 30 06:30:39 EDT 2011
https://bugzilla.novell.com/show_bug.cgi?id=683712
https://bugzilla.novell.com/show_bug.cgi?id=683712#c0
Summary: DataConverter.Unpack reads a double when float is
speficied
Classification: Mono
Product: Mono: Class Libraries
Version: 2.10.x
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: P5 - None
Component: CORLIB
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: kenneth at hexad.dk
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
Created an attachment (id=422149)
--> (http://bugzilla.novell.com/attachment.cgi?id=422149)
Patch for DataConverter
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16
DataConverter.cs:583 has this fragment:
case 'f':
if (Prepare (buffer, ref idx, 4, ref align)){
result.Add (conv.GetDouble (buffer, idx));
idx += 4;
}
break;
As 'f' denotes a float, it should be changed to:
case 'f':
if (Prepare (buffer, ref idx, 4, ref align)){
result.Add (conv.GetFloat (buffer, idx));
idx += 4;
}
break;
Reproducible: Always
Steps to Reproduce:
1. Include DataConverter.cs in a project
2. Create a file with this code (test.cs):
namespace test { class test {
static void Main(string[] args)
{ DataConverter.unpack("%f", new byte[] { 0xbf, 0x80, 0x00, 0x00 }, 0); }
} }
3. Compile: mcs test.cs
4. Execute: mono test.exe
Actual Results:
System.ArgumentException: index
at Mono.DataConverter+CopyConverter.GetDouble (System.Byte[] data, Int32
index) [0x00000] in <filename unknown>:0
at Mono.DataConverter.Unpack (System.String description, System.Byte[]
buffer, Int32 startIndex) [0x00000] in <filename unknown>:0
at test.test.Main (System.String[] args) [0x00000] in <filename unknown>:0
Expected Results:
Not throw exception
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list