Opened 20 years ago

Closed 19 years ago

#994 closed defect (fixed)

postgis layers crash mapscript when sql exceeds buffer size

Reported by: pspencer@… Owned by: refractions
Priority: highest Milestone: 4.4 release
Component: PostGIS Interface Version: 4.3
Severity: major Keywords:
Cc:

Description

mappostgis.c uses fixed size buffers to process SQL.  The size is currently
fixed at 6000 bytes.  My application is generating SQL on the fly using
GeometryFromText with largish polygons that cause the SQL to be approx 28k
(that's just a single polygon).  While I am researching alternate solutions, I
think that this is a serious flaw in the postgis driver.

Ideal solution:

* remove the need for fixed size buffers

As a minimum:

* clean up all references to hard-coded buffer allocation and use a defined
value that can be changed in one place

* detect buffer overflow and report error instead of crashing PHP.

Personally, I think that the minimum should be met for a 4.4 release.  I have no
idea what would be required to eliminate the buffers entirely so I don't know if
that would be a reasonable change at this point for 4.4, but it should certainly
be considered for 4.5/6 or 5.0 (whichever comes next).

Change History (5)

comment:1 by pspencer@…, 20 years ago

Cc: dmorissette@… added

comment:2 by dmorissette, 20 years ago

dependson: 431
Milestone: 4.4 release
Paul, this issue with static buffers is not new, it was discussed in bug 431
already, and at other times on the lists before. Everytime someone runs into the
static buffer limitations we increase the buffer size, there has to be a better
way to do things... or at least we need some checking to prevent buffer
overflows and crashes of the software.

comment:3 by dmorissette, 20 years ago

dependson: 431

comment:4 by mark@…, 19 years ago

Status: newassigned

comment:5 by mark@…, 19 years ago

Resolution: fixed
Status: assignedclosed
This was fixed by a patch applyed against bug 1199, removing the fixed size buffers.
Note: See TracTickets for help on using tickets.