Skip to content

Commit e816d4c

Browse files
Labeling lines with zero lengths may cause the application to crash (#6493) (#6495)
Co-authored-by: Tamas Szekeres <szekerest@gmail.com>
1 parent 21f7229 commit e816d4c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mapprimitive.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ int msPolygonLabelPoint(shapeObj *p, pointObj *lp, double min_dimension)
15621562
void msPolylineComputeLineSegments(shapeObj *shape, struct polyline_lengths *pll)
15631563
{
15641564
int i, j;
1565-
double max_line_length=0, max_segment_length=0, segment_length;
1565+
double max_line_length=-1, max_segment_length=-1, segment_length;
15661566

15671567
pll->ll = msSmallMalloc(shape->numlines * sizeof(struct line_lengths));
15681568
pll->total_length = 0;
@@ -1571,7 +1571,7 @@ void msPolylineComputeLineSegments(shapeObj *shape, struct polyline_lengths *pll
15711571

15721572
for(i=0; i<shape->numlines; i++) {
15731573
struct line_lengths *ll = &pll->ll[i];
1574-
double max_subline_segment_length = 0;
1574+
double max_subline_segment_length = -1;
15751575

15761576
if(shape->line[i].numpoints > 1) {
15771577
ll->segment_lengths = (double*) msSmallMalloc(sizeof(double) * (shape->line[i].numpoints - 1));

0 commit comments

Comments
 (0)