[metapost] Bug in MetaPost

Taco Hoekwater taco at elvenkind.com
Mon Dec 16 10:10:37 CET 2013


Hi,

On 12/15/2013 05:50 PM, mskala at ansuz.sooke.bc.ca wrote:
> On Sun, 15 Dec 2013, Ariel Barton wrote:
>> This will print not "ABC\Gamma XYZ", but "ABC\Gamma\Gamma\Gamma\Gamma". If
>> the zeroth character in a font shows up in a string, the following
>> characters in that string are all converted to the same character.
>
> That sure sounds like there's some confusion happening between C-style
> null-terminated strings (which can't practically represent strings that
> contain the value zero) and Pascal-style counted strings (which can).

Yes indeed. And knowing that, the fix was a very easy onm-liner,
see below. I cannot do a release right now because of other half-
finished changes, but this bug will definitely be solved in the
next release.

Best wishes,
Taco


Modified: trunk/source/texk/web2c/mplibdir/mp.w
===================================================================
--- trunk/source/texk/web2c/mplibdir/mp.w	2013-09-24 21:46:07 UTC (rev 1927)
+++ trunk/source/texk/web2c/mplibdir/mp.w	2013-12-16 09:08:23 UTC (rev 1928)
@@ -33907,7 +33907,7 @@
        {
        mp_text_node p0 = (mp_text_node)p;
        tt = (mp_text_object *) hq;
-      gr_text_p (tt) = mp_xstrdup (mp, mp_str (mp, mp_text_p (p)));
+      gr_text_p (tt) = mp_xstrldup (mp, mp_str (mp, mp_text_p 
(p)),mp_text_p (p)->len);
        gr_text_l (tt) = (size_t) mp_text_p (p)->len;
        gr_font_n (tt) = (unsigned int) mp_font_n (p);
        gr_font_name (tt) = mp_xstrdup (mp, mp->font_name[mp_font_n (p)]);




More information about the metapost mailing list