Opened 11 years ago

Closed 11 years ago

Last modified 11 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@…


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 Changed 11 years ago by Even Rouault

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 Changed 11 years ago by Even Rouault

Test added in r16058

Note: See TracTickets for help on using tickets.