Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1825 closed defect (fixed)

containsproperly: Conditional jump or move depends on uninitialised value(s)

Reported by: strk Owned by: pramsey
Priority: high Milestone: PostGIS 1.5.5
Component: postgis Version: 1.5.X
Keywords: Cc:

Description

Running one of the tests in our regression suite under valgrind gives a conditional jump depending on uninitialized error:

The query:

SELECT c, ST_ContainsProperly(ply, pt) FROM ( VALUES ('containsproperly099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), ('containsproperly103', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 5)'), ('containsproperly104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)')) AS v(c,ply,pt);

Note that you _need_ 3 records in there, or the error doesn't show up.

Change History (6)

comment:1 by strk, 12 years ago

Oh, and the valgrind error:

==4952== Conditional jump or move depends on uninitialised value(s)
==4952==    at 0x12597E15: GetPrepGeomCache (lwgeom_geos_prepared.c:336)
==4952==    by 0x1259570F: containsproperly (lwgeom_geos.c:2164)
==4952==    by 0x28CE60: ??? (in /usr/lib/postgresql/8.4/bin/postgres)

comment:2 by strk, 12 years ago

Code on line 336 is:

  else if ( pg_geom1 &&
            cache->argnum != 2 &&
            cache->pg_geom1_size == pg_geom1_size &&
            memcmp(cache->pg_geom1, pg_geom1, pg_geom1_size) == 0)

It is the memcmp being a problem, removing which there's no error anymore.

comment:3 by strk, 12 years ago

Fixed by r9749

comment:4 by strk, 12 years ago

it's to be checked if a backport to 1.5 is needed

comment:5 by pramsey, 12 years ago

Resolution: fixed
Status: newclosed

1.5 at r9751, 1.4 at r9752

comment:6 by robe, 12 years ago

Milestone: PostGIS 2.0.1PostGIS 1.5.5
Version: 2.0.x1.5.X
Note: See TracTickets for help on using tickets.