Andrew Dunstan <and...@dunslane.net> wrote:

> > Thanks. The backtrace is kind of strange, but I might have found it.
> > Could you please update from CVS and re-run?
> 
> same result ;-(

Hi, I found the cause.

Segfault comes from the following lines.
[ecpg/test/connect/test1.pgc]
        exec sql connect to tcp:postgresql://localhost/ user connectdb;
        exec sql disconnect;

-> ECPGdisconnect()
    -> ecpg_finish()
        -> ecpg_log("ecpg_finish: connection %s closed\n", act->name);
<HERE>      -> vfprintf(debugstream, fmt, ap);

Actual error occurs in vfprintf() because act->name can be NULL.
sprintf(..., "%s", NULL) could work on some platform (the result is '(null)'),
but it crashes on Windows (msvcrt). We need to avoid passing NULLs as
arguments to "%s" format for printf families.

The attached patch fixes the segfault. Regression tests can finish
successfully but there is still a difference. The diff seems to be
trivial and come from error message changes.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment: regression.diffs
Description: Binary data

Attachment: ecpg-fix.patch
Description: Binary data

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

Reply via email to