[Mono-bugs] [Bug 457038] New: 64-Bit issue when calling GetBytes
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sat Dec 6 07:25:17 EST 2008
https://bugzilla.novell.com/show_bug.cgi?id=457038
Summary: 64-Bit issue when calling GetBytes
Product: Mono: Class Libraries
Version: SVN
Platform: 64bit
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Mono.Data.Sqlite
AssignedTo: mhabersack at novell.com
ReportedBy: daniel at hofmannmail.ath.cx
QAContact: mono-bugs at lists.ximian.com
Found By: ---
I'm randomly getting a SEGFAULT, when calling SqliteReader.GetBytes on my
64-bit system. (Below is a suggested solution)
A more precise description is in my comment at
https://bugzilla.novell.com/show_bug.cgi?id=398470
Thread @1 received signal 11 at #0: 0x7f2ea684400b in memcpy+0x15b.
0x7f2ea684400b repz movsq %ds:(%rsi),%es:(%rdi)
Process #1 created new thread @24.
Thread @21 exited.
(mdb) bt
(*) #0: 0x7f2ea684400b in memcpy+0x15b
#1: 0x411566d8 in
System.Runtime.InteropServices.Marshal.Copy(System.IntPtr, byte[], int,
int)+0x28 at
/home/dani_nobkup/src/mono/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs:162
#2: 0x41156514 in
Mono.Data.Sqlite.Sqlite3.GetBytes(Mono.Data.Sqlite.SqliteStatement, int, int,
byte[], int, int)+0xd4 at
/home/dani_nobkup/src/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs:476
#3: 0x41156427 in Mono.Data.Sqlite.SqliteDataReader.GetBytes(int, long,
byte[], int, int)+0x67 at
/home/dani_nobkup/src/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs:344
#4: 0x41151cac in
<EvoLab.Common.Output.DbReader/<ReadData>c__Iterator0:MoveNext ()>+0x3ec at 135
#5: 0x4112e0cb in <EvoLab.Vis.OutputStorage:GetCachedData
(EvoLab.Vis.Model.OutputNumberElement)>+0x21b at 39
#6: 0x4112de98 in <EvoLab.Vis.Model.RepetitionDataConfigurator:GetData
()>+0x28 at 7
[..]
That knowing, I'm pretty sure, the error lies in SQLite3.cs from
Mono.Data.Sqlite.dll, more precisely here:
internal override long GetBytes(SqliteStatement stmt, int index, int
nDataOffset, byte[] bDest, int nStart, int nLength)
{
IntPtr ptr;
int nlen;
int nCopied = nLength;
nlen = UnsafeNativeMethods.sqlite3_column_bytes(stmt._sqlite_stmt,
index);
ptr = UnsafeNativeMethods.sqlite3_column_blob(stmt._sqlite_stmt, index);
if (bDest == null) return nlen;
if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart;
if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset;
if (nCopied > 0)
Marshal.Copy((IntPtr)(ptr.ToInt32() + nDataOffset), bDest, nStart,
nCopied);
else nCopied = 0;
return nCopied;
}
Changing the invocation of Marshal.Copy to ptr.ToInt64() prevented the issue
for me, but I was suggested, to use
(IntPtr)((byte*) ptr + nDataOffset)
instead.
The same issue seems to exist with System.Data.SQLite as well, but I'll leave
it to you, to report to them :)
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list