Code

Opened 4 months ago

Closed 4 months ago

Last modified 4 months 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

Description

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
Aborted

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 claudep 4 months ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 4 months ago by claudep

  • Component changed from Uncategorized to GIS
  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Thanks for the report. Mind reviewing the attached patch?

Changed 4 months ago by claudep

comment:2 Changed 4 months ago by bugs@…

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

Merry xmas all.

comment:3 Changed 4 months ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 542198c1d059b3ecf64477c1c10c0518d229345b:

Fixed #21662 -- Kept parent reference in prepared geometry

Thanks Robert Scott for the report.

comment:4 Changed 4 months ago by shai

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

comment:5 Changed 4 months ago by Claude Paroz <claude@…>

In b536ad09cadc087b7559db2f8cca50f06c6e8f34:

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

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.