pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[PATCH] EXC_BAD_ACCESS in SC_execute
2+ messages / 2 participants
[nested] [flat]

* [PATCH] EXC_BAD_ACCESS in SC_execute
@ 2014-08-26 21:25 Jade Koskela <jkoskela0@gmail.com>
  2014-08-28 23:54 ` Re: [PATCH] EXC_BAD_ACCESS in SC_execute Inoue, Hiroshi <inoue@tpf.co.jp>
  0 siblings, 1 reply; 2+ messages in thread

From: Jade Koskela @ 2014-08-26 21:25 UTC (permalink / raw)
  To: pgsql-odbc

Hello,

I am looking into dmp files which we collect when our application crashes.
Using google breakpad/stackwalking I am generating the stacktrace. The
crash looks like this:

Crash reason:  EXC_BAD_ACCESS / 0x0000000d
Crash address: 0x0

Thread 10 (crashed)
 0  psqlodbcw.so!SC_Execute    + 0x10bd

I couldn't get the source line so I had to dig through the assembly.
I was able to determine the error is happening on line statement.c line
2191 (from the latest version in the repository).

numcols = QR_NumResultCols(tres);
   (this expands to)
numcols = tres->fields->num_fields

The crash happens on the dereference of fields. It could be a null pointer,
I'm not sure because I can't reproduce the error.
Apparently EXC_BAD_ACCESS can be SIGSEGV or SIGBUS.
I have generated a patch to handle the null pointer case.

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Attachments:

QR_NumResultCols-NullCheck.patch (application/octet-stream, 976B) download commit c6030c2655315c97165f1c6fb3122b5ba8c13006 Author: Jade Koskela <jkoskela@tableausoftware.com> Date: Tue Aug 26 14:21:23 2014 -0700 Add null check to QR_NumResultCols macro. diff --git a/qresult.h b/qresult.h index 8a9315e..f0f31cb 100644 --- a/qresult.h +++ b/qresult.h @@ -134,7 +134,7 @@ enum { #define QR_get_value_backend_int(self, tupleno, fieldno, isNull) atoi(QR_get_value_backend_row(self, tupleno, fieldno)) /* These functions are used by both manual and backend results */ -#define QR_NumResultCols(self) (CI_get_num_fields(self->fields)) +#define QR_NumResultCols(self) (self->fields ? CI_get_num_fields(self->fields) : 0) #define QR_NumPublicResultCols(self) (QR_haskeyset(self) ? (CI_get_num_fields(self->fields) - self->num_key_fields) : CI_get_num_fields(self->fields)) #define QR_get_fieldname(self, fieldno_) (CI_get_fieldname(self->fields, fieldno_)) #define QR_get_fieldsize(self, fieldno_) (CI_get_fieldsize(self->fields, fieldno_))
^ permalink raw reply [nested|flat] 2+ messages in thread

* Re: [PATCH] EXC_BAD_ACCESS in SC_execute
  2014-08-26 21:25 [PATCH] EXC_BAD_ACCESS in SC_execute Jade Koskela <jkoskela0@gmail.com>
@ 2014-08-28 23:54 ` Inoue, Hiroshi <inoue@tpf.co.jp>
  0 siblings, 0 replies; 2+ messages in thread

From: Inoue, Hiroshi @ 2014-08-28 23:54 UTC (permalink / raw)
  To: Jade Koskela <jkoskela0@gmail.com>; +Cc: pgsql-odbc

Hi Jade,

(2014/08/27 6:25), Jade Koskela wrote:
> Hello,
>
> I am looking into dmp files which we collect when our application
> crashes. Using google breakpad/stackwalking I am generating the
> stacktrace. The crash looks like this:
>
> Crash reason:  EXC_BAD_ACCESS / 0x0000000d
> Crash address: 0x0
>
> Thread 10 (crashed)
>   0  psqlodbcw.so!SC_Execute    + 0x10bd
>
> I couldn't get the source line so I had to dig through the assembly.
> I was able to determine the error is happening on line statement.c line
> 2191 (from the latest version in the repository).

Did you build binaries from the latest git?

> numcols = QR_NumResultCols(tres);
>     (this expands to)
> numcols = tres->fields->num_fields
>
> The crash happens on the dereference of fields. It could be a null
> pointer, I'm not sure because I can't reproduce the error.
> Apparently EXC_BAD_ACCESS can be SIGSEGV or SIGBUS.
> I have generated a patch to handle the null pointer case.

OK I would check whether fields could be null or not.
It would take some time because I don't have much time.

regards,
Hiroshi Inoue


-- 
I am using the free version of SPAMfighter.
SPAMfighter has removed 12430 of my spam emails to date.
Get the free SPAMfighter here: http://www.spamfighter.com/len

Do you have a slow PC? Try a Free scan 
http://www.spamfighter.com/SLOW-PCfighter?cid=sigen



-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2014-08-28 23:54 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-08-26 21:25 [PATCH] EXC_BAD_ACCESS in SC_execute Jade Koskela <jkoskela0@gmail.com>
2014-08-28 23:54 ` Inoue, Hiroshi <inoue@tpf.co.jp>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox