[mapserver-dev] Rendering raster fonts with AGG may cause crash in mapserver

Tamas Szekeres szekerest at gmail.com
Fri Aug 15 06:13:19 EDT 2008

2008/8/15 thomas bonfort <thomas.bonfort at gmail.com>:
> Hi,
> On Thu, Aug 14, 2008 at 10:29 PM, Tamas Szekeres <szekerest at gmail.com> wrote:
>> Hi All,
>> I've noticed that rendering raster fonts when the character code falls
>> outside of the 23-127 domain may cause crash in mapserver. I've
>> attached a possible fix with a new ticket see:
>> http://trac.osgeo.org/mapserver/ticket/2739
>> Should I apply the fix?
> I'd prefer to keep the agg specific code inside the
> AGGMapserverRenderer object, in the renderRasterGlyphs member
> function, what do you think?


Yes, I'll prepare a fix accordingly. In addition I'll have to
duplicate the string in order not to do permanent changes during the

>> Anyway, I'm a bit disappointed that AGG cannot render localized raster
>> fonts with above of 127 character codes at all.
> yes and no:
> * the code shouldn't be segfaulting

But it does that at the moment. There is a signed char to unsigned int
conversion in the agg renderer code which causes that the negative
character codes are converted to large integer numbers.  Then this
number is blindly used as an index to access the pixel information of
the corresponding character in the array specified in
See also "render_text' in agg_renderer_raster_text.h line 51 and
'prepare' in agg_glyph_raster_bin.h line 82

I consider this as a deficiency of the agg library itself but I'm not
too keen to prepare fixes for AGG at the moment. (I'm using AGG 2.4
right now)

> * raster fonts are kind of a hack, and characters above 127 depend on
> the encoding, so even if the >127 chars were supported, there'd be
> only a slim chance that they corresponded to the encoding you where
> looking for

Would it be reasonable to fall back to the GD renderer in this case?

Best regards,


More information about the mapserver-dev mailing list