X-Original-To: pgsql-odbc@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CB0FC475D64 for ; Mon, 3 Feb 2003 07:42:35 -0500 (EST) Received: from ns.aprote.ee (ns.aprote.ee [80.235.78.106]) by postgresql.org (Postfix) with ESMTP id 94404475F1C for ; Mon, 3 Feb 2003 07:42:22 -0500 (EST) Received: Message by Barricade ns.aprote.ee with ESMTP id h13ChtQ21313 for ; Mon, 3 Feb 2003 14:43:55 +0200 Received: from TAMBETM ([192.168.1.14]) by black.aprote.com with Microsoft SMTPSVC(5.0.2195.5329); Mon, 3 Feb 2003 14:42:24 +0200 Message-ID: <000901c2cb81$b3a749e0$0e01a8c0@aprote.com> From: "Tambet Matiisen" To: "Tambet Matiisen" , References: <000701c2c90c$a1c77870$0e01a8c0@aprote.com> Subject: Re: psqlodbc.dll crash Date: Mon, 3 Feb 2003 14:42:24 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-OriginalArrivalTime: 03 Feb 2003 12:42:24.0536 (UTC) FILETIME=[B3AB4180:01C2CB81] Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/4 X-Sequence-Number: 2622 ----- Original Message ----- From: "Tambet Matiisen" To: Sent: Friday, January 31, 2003 11:39 AM Subject: [ODBC] psqlodbc.dll crash > Psqlodbc.dll crashes my application occasionally with following error: > Unhandled exception in VB6.EXE (PSQLODBC.DLL): 0xC0000005: Access Violation. > > The error occurs when I have 3 opened ADO recordsets, I requery all of them > and then open one more recordset. And I have to do this 5-6 times to get > this error. All recordsets are static and client-side. If someone could send > me debug version of the dll, I could give more information. > > Tambet > > I resolved the issue, parameters of one of the recordsets did not have default values. But it still indicates, that error handling in driver could be improved. The query executed was: conn=3D82461600, query=3D'SELECT kood as "Kood", nimetus as "Nimetus", prioriteet as "Prioriteet", mat_id, yhik, erikaal, viimane_hind, broneeritud, olemas, tellitud, (mat.tellitud + mat.olemas - mat.broneeritud) AS saldo FROM materjalid mat WHERE kood LIKE '=90' AND lower(nimetus) LIKE lower('=06')' Note the abnormal characters in where condition. The crash occurred in convert_special_chars() in convert.c: convert_special_chars(const char * 0x045fe000, char * 0x00000000, int -5, int 1, int 0) line 3381 + 36 bytes ResolveOneParam(_QueryBuild * 0x0012deec) line 2634 + 35 bytes inner_process_tokens(_QueryParse * 0x0012df30, _QueryBuild * 0x0012deec) line 2190 + 9 bytes copy_statement_with_parameters(StatementClass_ * 0x04ffe3c8, int 0) line 1921 + 19 bytes Exec_with_parameters_resolved(StatementClass_ * 0x04ffe3c8, int * 0x0012e0d4) line 222 + 13 bytes PGAPI_Execute(void * 0x04ffe3c8) line 596 + 13 bytes SQLExecute(void * 0x04ffe3c8) line 279 + 9 bytes ODBC32! 1f7cd8eb() MSDASQL! 1f6c78cb() MSDASQL! 1f69c94b() MSDASQL! 1f69c688() 0012e34c() The error was on line 3381: for (i =3D 0; i < max && si[i]; i++) Probably because si[i] was out of bounds. But this should have been eliminated by i < max condition. Max is calculated based on parameter 'used' of the same function: if (used =3D=3D SQL_NTS) max =3D strlen(si); else max =3D used; As you can see from stack trace earlier, used =3D -5. But SQL_NTS is defined as -1. This means, that max gets value -5. But as max is of unsigned type (size_t), the actual value is 4294967291 instead. This allows above mentioned cycle to go out of bounds. I don't have the knowledge and time to fix this error by myself. But it would be nice if someone could have a look. Tambet PS. Source distribution of psqlodbc.dll 7.2.5 was not complete, setup.c and some other files were missing. I used the CVS snapshot, but still couldn't compile the non-multibyte version. Multibyte version was OK. PPS. It took me some time to find out how to access CVS on gborg.postgresql.org. I could not find any official documentation on Gborg website. Finally I found some instructions in list archives.