Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#21662 closed Bug (fixed)

Crash if a GEOS prepared geometry's parent geometry loses reference

Reported by: bugs@… Owned by: nobody
Component: GIS Version: 1.6
Severity: Normal Keywords: gis geos prepared multipolygon
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Django 1.6.1, libgeos-c1 debian version 3.3.3-1.1

The following:

>>> from django.contrib.gis.geos import GEOSGeometry , Point
>>> g = GEOSGeometry ( "MULTIPOLYGON (((0.5694200000000000 51.0155570000000012, 0.5682199999999999 51.1943380000000019, 0.7769980000000000 51.1763400000000033, 0.7637990000000000 50.9747619999999984, 0.5694200000000000 51.0155570000000012)), ((-0.5128650000000000 51.8554680000000019, 0.3390440000000000 51.8014739999999989, 0.3306450000000000 51.1175470000000018, -0.1577030000000000 51.2423330000000021, -0.6244530000000000 51.1091470000000001, -0.6664480000000000 51.7426800000000000, -0.5128650000000000 51.8554680000000019)))")
>>> g = g.prepared
>>> g.contains ( Point ( 0 , 0 ) )

causes a crash:

pure virtual method called
terminate called without an active exception

It seems a reference to the parent geometry isn't being kept by the prepared geometry, it's getting garbage collected and the following vtable lookup goes awry. Just a guess.

Originally discovered on django 1.4.3.

Attachments (1)

21662.diff (1.3 KB ) - added by Claude Paroz 11 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Claude Paroz, 11 years ago

Component: UncategorizedGIS
Has patch: set
Triage Stage: UnreviewedAccepted

Thanks for the report. Mind reviewing the attached patch?

by Claude Paroz, 11 years ago

Attachment: 21662.diff added

comment:2 by bugs@…, 11 years ago

Huzzah - patch works for me fuzzy-applied to 1.6.1. Many thanks.

Merry xmas all.

comment:3 by Claude Paroz <claude@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 542198c1d059b3ecf64477c1c10c0518d229345b:

Fixed #21662 -- Kept parent reference in prepared geometry

Thanks Robert Scott for the report.

comment:4 by Shai Berger, 11 years ago

Is there a reason not to backport this to 1.6.x?

comment:5 by Claude Paroz <claude@…>, 11 years ago

In b536ad09cadc087b7559db2f8cca50f06c6e8f34:

[1.6.x] Fixed #21662 -- Kept parent reference in prepared geometry

Thanks Robert Scott for the report.
Backport of 542198c1d0 from master.

Note: See TracTickets for help on using tickets.
Back to Top