Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jGemP-0006Xx-5d for pgsql-odbc@arkaria.postgresql.org; Tue, 24 Mar 2020 08:19:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jGemN-0004iT-Vo for pgsql-odbc@arkaria.postgresql.org; Tue, 24 Mar 2020 08:19:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jGemN-0004iL-KG for pgsql-odbc@lists.postgresql.org; Tue, 24 Mar 2020 08:19:19 +0000 Received: from mail01.asahi-net.or.jp ([202.224.55.13]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jGemE-0001eM-Tn for pgsql-odbc@postgresql.org; Tue, 24 Mar 2020 08:19:17 +0000 Received: from [192.168.0.7] (KD124208079206.ppp-bb.dion.ne.jp [124.208.79.206]) (Authenticated sender: GQ9H-INUE) by mail01.asahi-net.or.jp (Postfix) with ESMTPA id 02139577C0; Tue, 24 Mar 2020 17:19:04 +0900 (JST) Subject: Re: Patch to solve memory protect violation and clear __error_number after call CC_lookup_characterset To: martial.guex@mutech.ch References: From: "Inoue, Hiroshi" Cc: pgsql-odbc@postgresql.org Message-ID: <152bdf12-5700-e640-3c75-eea299631129@dream.email.ne.jp> Date: Tue, 24 Mar 2020 17:19:03 +0900 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello Martial, The bugs were fixed in version 9.06.0500. Please try the latest version(12.01.0000). regards, Hiroshi Inoue On 2020/03/22 22:43, martial.guex@mutech.ch wrote: > Hello, > > I have detected fatal memory error protection on call strdup > connectio.c(1045) and wrong setting conn.__error_number on > CC_lookup_lo when "select oid, typbasetype from pg_type where typname > = 'lo'" doesn't return any record. > > I used this patch to solve the problem on debian stretch with > odbc-postgresql:amd64 version 1:09.05.0400-2. > > --- psqlodbc-09.05.0400.orig/connection.c > +++ psqlodbc-09.05.0400/connection.c > @@ -1041,12 +1041,13 @@ CC_connect(ConnectionClass *self, char * >   if (retsend) >       retsend = CC_send_settings(self, > GET_NAME(self->connInfo.conn_settings)); > > -    if (CC_get_errornumber(self) > 0) > +    if ((CC_get_errornumber(self) > 0) && (CC_get_errormsg(self) != > NULL)) >          saverr = strdup(CC_get_errormsg(self)); >      CC_clear_error(self);            /* clear any error */ >      CC_lookup_lo(self);            /* a hack to get the oid of >                             our large object oid type */ > > +    CC_clear_error(self);            /* clear any error */ >      /* Multibyte handling */ >      CC_lookup_characterset(self); >      if (CC_get_errornumber(self) > 0) > > It's probably better to clear self.__error_number directly on > CC_lookup_lo and when error_number is equal 110. > > Thank's for the job.