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

thomas bonfort thomas.bonfort at gmail.com
Fri Aug 15 06:29:35 EDT 2008


On Fri, Aug 15, 2008 at 12:13 PM, Tamas Szekeres <szekerest at gmail.com> wrote:
> 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?
>>
>
> Thomas,
>
> 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
> masking.
>
thanks. feel free to commit that, I'll be offline for a few weeks from now

>>>
>>> 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
> agg_embedded_raster_fonts.cpp.
> 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)
I think there's no point in submitting patches upstream right now
given the direction agg is heading. there might be some changes in the
project governance coming soon ( wink danmo ), so we can keep those
changes and apply them when things settle down.
http://article.gmane.org/gmane.comp.graphics.agg/4336

>
>> * 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?
unfortunately no, the agg and gd image buffers are incompatible, and
we're using a hack to switch from one to the other depending on the
layer type (we switch to gd for everything raster related). switching
from one to the other inside the label(cache) rendering function would
have drastic effects performance-wise.


cheers,
thomas


More information about the mapserver-dev mailing list