Ticket #108 (closed defect: duplicate)

Opened 2 years ago

Last modified 2 years ago

Segmentation fault in pj_insert_initcache

Reported by: apalade Owned by: warmerdam
Priority: major Milestone:
Component: Core Version: 4.7.0
Keywords: segmentation fault cache init Cc:

Description

Segmentation fault happens when trying to create more than a certain number of projection definitions (on my platform this was 14 definitions).

I found the bug using the Perl interface, Geo::Proj4. Some platform details:

  • 2.6.36-gentoo x86_64
  • perl 5.12.2
  • Geo::Proj4 0.99

Repro code here:

use strict;
use warnings;

use Geo::Proj4;

my @projections = qw( esri:37001 esri:37002 esri:37003 esri:37004 esri:37005 esri:37006 esri:37007 esri:37008 esri:37201 esri:37202 esri:37203 esri:37204 esri:37205 esri:37206 esri:37207 epsg:2045 epsg:2000 epsg:2094 epsg:2095 );

foreach ( @projections ) {
	Geo::Proj4->new( "+init=" . $_ );
}

The problem was caused by a faulty memcpy in pj_initcache.c which was happening when trying to enlarge the cache to hold more projections definitions. I've attached a patch that fixes the bug.

Cheers, Alexandru Palade

Attachments

cache_init.patch Download (468 bytes) - added by apalade 2 years ago.

Change History

Changed 2 years ago by apalade

Changed 2 years ago by apalade

I forgot to mention... this bug manifests when instantiating definitions for different projections. You can instantiate any number of objects as long as they are all within the 15 projections or whatever your platform-specific number is.

Changed 2 years ago by warmerdam

  • status changed from new to closed
  • resolution set to duplicate

I believe this is a duplicate of #100, and fixed by r1988.

Changed 2 years ago by apalade

My apologies. I checked the open tickets but didn't look at the resolved ones.

Note: See TracTickets for help on using tickets.