Program received signal EXC_BAD_ACCESS, Could not access memory.

Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=4045

Reported by Fredrik Noring, Roxen Internet Software noring@roxen.com

This program:

int main(int argc, array(string) argv)
{
  object sql = Sql.sql("odbc://...");

  sql->query(#"SELECT rv_cust_attribs.attrib_id,
                      rv_cust_attribs.attr_name,
                      rv_doc_attribs.value
                 FROM rv_doc_attribs, rv_cust_attribs
                WHERE rv_doc_attribs.document_id = 279
                  AND rv_doc_attribs.attrib_id = rv_cust_attribs.attrib_id
                  AND rv_cust_attribs.attr_name = 'metadatadump'");

  return 0;
}

gives:

Program received signal EXC_BAD_ACCESS, Could not access memory.
0x00794e18 in f_fetch_row (args=25393152) at /home/distmaker/Distmaker/4.0/build
/pike.macosx/pike/src/modules/Odbc/odbc_result.c:462
462     /home/distmaker/Distmaker/4.0/build/pike.macosx/pike/src/modules/Odbc/od
bc_result.c: No such file or directory.
        in /home/distmaker/Distmaker/4.0/build/pike.macosx/pike/src/modules/Odbc
/odbc_result.c
(gdb) bt
#0  0x00794e18 in f_fetch_row (args=25393152) at /home/distmaker/Distmaker/4.0/b
uild/pike.macosx/pike/src/modules/Odbc/odbc_result.c:462
#1  0x00794e14 in f_fetch_row (args=25393152) at /home/distmaker/Distmaker/4.0/b
uild/pike.macosx/pike/src/modules/Odbc/odbc_result.c:462
#2  0x00016254 in low_mega_apply (type=7949128, args=1965952, arg1=0x1dff80, arg
2=0x1837800) at /home/distmaker/Distmaker/4.0/build/pike.macosx/pike/src/apply_l
ow.h:195
#3  0x00013610 in opcode_F_CALL_OTHER (arg1=1965952) at /home/distmaker/Distmake
r/4.0/build/pike.macosx/pike/src/interpret_functions_fixed.h:1933
#4  0x007548c0 in ?? ()
#5  0x000170fc in o_catch (pc=0x783834) at /home/distmaker/Distmaker/4.0/build/p
ike.macosx/pike/src/interpret.c:1818
#6  0x0000fd28 in opcode_F_CATCH () at /home/distmaker/Distmaker/4.0/build/pike.
macosx/pike/src/interpret_functions_fixed.h:1210
#7  0x00783830 in ?? ()
#8  0x00016f9c in mega_apply (type=25393152, args=-1073745569, arg1=0x3, arg2=0x
198644cc) at /home/distmaker/Distmaker/4.0/build/pike.macosx/pike/src/interpret.
c:1774
#9  0x0007a424 in main (argc=2, argv=0xbffffe08) at /home/distmaker/Distmaker/4.
0/build/pike.macosx/pike/src/main.c:756