guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: crash in guile-sqlite3


From: Joonas Sarajärvi
Subject: Re: crash in guile-sqlite3
Date: Tue, 1 May 2012 18:01:06 +0300

2012/5/1 Joonas Sarajärvi <address@hidden>:

> However, thank you for taking a look at the problem. The change you
> placed at 
> git://gitorious.org/~sunjoong/guile-sqlite3/sunjoongs-guile-sqlite3.git
> seems to completely resolve the crash for me.
>
> -Joonas

Replying to myself, I now noticed that the change will not work in a
64-bit computer. My impression is that this is due to the fact that
the 5th parameter taken by sqlite3_bind_text function is really a
pointer and not an int. On amd64 computers, int are 4 bytes wide while
pointers are 8 bytes.

I also think that the older way of passing SQLITE_TRANSIENT as a
pointer should work. However, there was a small bug in the code that
constructed the pointer. I made a yet-another clone of the main
guile-sqlite3 repository and pushed a change that I think fixes this.
The change I did is also here:

diff --git a/sqlite3.scm b/sqlite3.scm
index fcc1fdf..5047e71 100644
--- a/sqlite3.scm
+++ b/sqlite3.scm
@@ -301,8 +301,9 @@
                     int
                     (dynamic-func "sqlite3_bind_null" libsqlite3)
                     (list '* int)))
-        (sqlite-transient (bytevector->pointer
-                           (make-bytevector (sizeof '*) #xff))))
+        (sqlite-transient (dereference-pointer
+                           (bytevector->pointer
+                            (make-bytevector (sizeof '*) #xff)))))
     (lambda (stmt key val)
       (assert-live-stmt! stmt)
       (let ((idx (key->index stmt key))


The test case by Sunjoong Lee is also cherry-picked to the git branch
I placed on gitorious. Hopefully it was acceptable to include it.
Should I make a merge request of this?

-Joonas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]