pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feedBuild failure with VS 2012 due to uninitialized pointers
3+ messages / 2 participants
[nested] [flat]
* Build failure with VS 2012 due to uninitialized pointers
@ 2014-06-12 07:53 Craig Ringer <craig@2ndquadrant.com>
2014-06-14 13:36 ` Re: Build failure with VS 2012 due to uninitialized pointers Inoue, Hiroshi <inoue@tpf.co.jp>
0 siblings, 1 reply; 3+ messages in thread
From: Craig Ringer @ 2014-06-12 07:53 UTC (permalink / raw)
To: pgsql-odbc
Hi folks
VS 2012 reports possibly uninitialized pointer access:
c:\users\administrator\desktop\psqlodbc\connection.c(2073): error C4703:
potentially uninitialized local pointer variable 'sock' used
which is
if (0 != (sockerr = SOCK_get_errcode(sock)))
{
in original_CC_connect(...).
c:\users\administrator\desktop\psqlodbc\dlg_wingui.c(177): error C4703:
potentially uninitialized local pointer variable 'comval' used
which is
CheckDlgButton(hdlg, DRV_COMMLOG, comval->commlog);
By default it treats these as fatal errors, so the codebase won't build
on VS 2012. BuildAll.ps1 doesn't seem to provide a simple way to pass
extra CFLAGS into the build (to pass /sdl- per
http://msdn.microsoft.com/en-us/library/jj161081.aspx), and it isn't
really desirable to just turn the warning off anyway.
I've taken a look at what's going on. In the case of the first one the
function is not small and its flow isn't simple. I thought I'd mention
the issue here first, in case somebody was able to immediately see
what's missing. While I could just:
- SocketClass *sock;
+ SocketClass *sock = NULL;
I'm pretty sure that's just papering over whatever the real problem is.
The second, the comval error, looks to be a missing default: clause in
the case. If this were backend code I'd just toss in an
elog(FATAL,"Unreachable code reached");
but that's not going to be much good in psqlODBC.
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
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] 3+ messages in thread
* Re: Build failure with VS 2012 due to uninitialized pointers
2014-06-12 07:53 Build failure with VS 2012 due to uninitialized pointers Craig Ringer <craig@2ndquadrant.com>
@ 2014-06-14 13:36 ` Inoue, Hiroshi <inoue@tpf.co.jp>
2014-06-16 04:14 ` Re: Build failure with VS 2012 due to uninitialized pointers Craig Ringer <craig@2ndquadrant.com>
0 siblings, 1 reply; 3+ messages in thread
From: Inoue, Hiroshi @ 2014-06-14 13:36 UTC (permalink / raw)
To: Craig Ringer <craig@2ndquadrant.com>; pgsql-odbc
Thanks.
Confirmed and committed.
regards,
Hiroshi Inoue
(2014/06/12 16:53), Craig Ringer wrote:
> Hi folks
>
> VS 2012 reports possibly uninitialized pointer access:
>
>
>
>
> c:\users\administrator\desktop\psqlodbc\connection.c(2073): error C4703:
> potentially uninitialized local pointer variable 'sock' used
>
> which is
>
> if (0 != (sockerr = SOCK_get_errcode(sock)))
> {
>
> in original_CC_connect(...).
>
>
>
> c:\users\administrator\desktop\psqlodbc\dlg_wingui.c(177): error C4703:
> potentially uninitialized local pointer variable 'comval' used
>
> which is
>
> CheckDlgButton(hdlg, DRV_COMMLOG, comval->commlog);
>
>
>
>
> By default it treats these as fatal errors, so the codebase won't build
> on VS 2012. BuildAll.ps1 doesn't seem to provide a simple way to pass
> extra CFLAGS into the build (to pass /sdl- per
> http://msdn.microsoft.com/en-us/library/jj161081.aspx), and it isn't
> really desirable to just turn the warning off anyway.
>
>
> I've taken a look at what's going on. In the case of the first one the
> function is not small and its flow isn't simple. I thought I'd mention
> the issue here first, in case somebody was able to immediately see
> what's missing. While I could just:
>
>
> - SocketClass *sock;
> + SocketClass *sock = NULL;
>
> I'm pretty sure that's just papering over whatever the real problem is.
>
>
> The second, the comval error, looks to be a missing default: clause in
> the case. If this were backend code I'd just toss in an
>
> elog(FATAL,"Unreachable code reached");
>
> but that's not going to be much good in psqlODBC.
--
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] 3+ messages in thread
* Re: Build failure with VS 2012 due to uninitialized pointers
2014-06-12 07:53 Build failure with VS 2012 due to uninitialized pointers Craig Ringer <craig@2ndquadrant.com>
2014-06-14 13:36 ` Re: Build failure with VS 2012 due to uninitialized pointers Inoue, Hiroshi <inoue@tpf.co.jp>
@ 2014-06-16 04:14 ` Craig Ringer <craig@2ndquadrant.com>
0 siblings, 0 replies; 3+ messages in thread
From: Craig Ringer @ 2014-06-16 04:14 UTC (permalink / raw)
To: Inoue, Hiroshi <inoue@tpf.co.jp>; pgsql-odbc
On 06/14/2014 09:36 PM, Inoue, Hiroshi wrote:
>
> Confirmed and committed.
It looks like you've initialized both to NULL.
That'll make the warning go away, but doesn't mean there isn't
potentially a bug in the handling of the socket pointer.
I'm sure you have no more time to chase it up than I do, so I'm not
asking you to do any more. I'm just making a note here so a search in
the archives that finds this sees that there might still be more to this
issue that we haven't covered.
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
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] 3+ messages in thread
end of thread, other threads:[~2014-06-16 04:14 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-06-12 07:53 Build failure with VS 2012 due to uninitialized pointers Craig Ringer <craig@2ndquadrant.com>
2014-06-14 13:36 ` Inoue, Hiroshi <inoue@tpf.co.jp>
2014-06-16 04:14 ` Craig Ringer <craig@2ndquadrant.com>
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