Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#2767 closed defect (fixed)

PG driver: GetFeature(id) with an invalid id crashes OGR

Reported by: Even Rouault Owned by: Even Rouault
Priority: normal Milestone: 1.5.4
Component: default Version: unspecified
Severity: normal Keywords: pg getfeature
Cc: thomas.bonfort@…

Description

In OGRPGTableLayer::GetFeature(), the following snippet should check that in addition to the successful status, the number of rows is > 0. Aditionnaly, if the number of rows is strictly > 1, we could also issue a warning!

        hResult = PQexec(hPGConn, "FETCH ALL in getfeaturecursor" );

        if( hResult && PQresultStatus(hResult) == PGRES_TUPLES_OK )
        {
            hCursorResult = hResult;
            poFeature = RecordToFeature( 0 );
            hCursorResult = NULL;
        }

Change History (2)

comment:1 by Even Rouault, 15 years ago

Resolution: fixed
Status: newclosed
Type: enhancementdefect

Fixed in trunk in r16055, in branches/1.6 in r16056 and in branches/1.5 in r16057

comment:2 by Even Rouault, 15 years ago

Test added in r16058

Note: See TracTickets for help on using tickets.