Ticket #4090 (closed defect: fixed)

Opened 18 months ago

Last modified 16 months ago

Label size of zero causes divide by zero error

Reported by: andystone Owned by: tbonfort
Priority: normal Milestone: 6.0.2 release
Component: MapServer C Library Version: 6.0
Severity: normal Keywords:
Cc: tbonfort, dmorissette

Description

I was following the tutorial at  http://trac.osgeo.org/mapserver/wiki/RenderingOsmDataUbuntu, trying to render open streetmap data with mapserver. I'm using a UK extract of the OSM data.

Everything seemed to be working ok except that once I zoomed in to level 12, some map areas would fail to render. I was initially using the Ubuntu mapserver package, but switched to version 6.0.1 compiled manually to figure out the problem.

After digging through the code, I am fairly sure that the problem occurs because in the example osm-google.map (from mapserver-utils), pedestrian areas have a label size of 0 for zoom level 12 and below. This means that in msAlignText (maplabel.c) you get a calculated spacewidth of zero (if label->space_size_10 is set to a non zero value), which leads to a divide by zero error when calculating nfracspaces around line 240, which in turn leads to a huge value of numspacestoadd and so a call to msSmallMalloc with a huge space request. This call fails and so the map fails to render.

Adding a check for a label size of zero would solve the problem.

Changing the label size to >0 for the pedestrian areas makes the problem go away.

I've marked it as a bug in the mapserver C library, but maybe a label size of 0 isn't allowed, in which case it's mapserver-utils that has the bug.

Change History

Changed 18 months ago by sdlime

  • cc tbonfort, dmorissette added
  • status changed from new to assigned
  • milestone set to 6.0.2 release

Changed 16 months ago by tbonfort

  • owner changed from sdlime to tbonfort
  • status changed from assigned to new

Changed 16 months ago by tbonfort

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

fixed in r13074

Note: See TracTickets for help on using tickets.