Opened 19 years ago

Last modified 19 years ago

#939 closed defect (fixed)

Postgresql crashes when inserting a feature doesn't work

Reported by: cfis@… Owned by: cfis@…
Priority: high Milestone:
Component: OGR_SF Version: unspecified
Severity: critical Keywords:
Cc:

Description

If you are using postgresql and inserting a feature fails, then your program
will crash with a segmentation fault.  A bit of  poking around shows the problem
on line 987 of ogrtablelayer.cpp:


    hResult = PQexec(hPGConn, pszCommand);
    if( PQresultStatus(hResult) != PGRES_COMMAND_OK )
    {
        CPLError( CE_Failure, CPLE_AppDefined,
                  "INSERT command for new feature         
                   failed.\n%s\nCommand:%s",
                   PQerrorMessage(hPGConn));

Note there are two %s format specifiers, but just one argument is passed. 
Should be:

        CPLError( CE_Failure, CPLE_AppDefined,
                  "INSERT command for new feature         
                   failed.\n%s\nCommand:%s",
                   PQerrorMessage(hPGConn), pszCommand);

Change History (1)

comment:1 by warmerdam, 19 years ago

Charlie applied this fix. 
Note: See TracTickets for help on using tickets.