Package: mscgen Version: 0.20-13 Followup-For: Bug #960405 User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu groovy ubuntu-patch
Hi Niels, This autopkgtest regression hit us also in Ubuntu, and I dug into it and found mscgen was blindly subtracting 1 from the "width" returned by libgd for the text bounding box; so if gd returned a bounding box of width 0, mscgen would blithely return -1 instead and things would go sideways. The attached patch handles this case and avoids returning a width of (unsigned int)-1, though I have my doubts about the correctness of the original code trying to fix up the bounding box width as well. Cheers, -- Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. Ubuntu Developer https://www.debian.org/ slanga...@ubuntu.com vor...@debian.org
diff -Nru mscgen-0.20/debian/patches/series mscgen-0.20/debian/patches/series --- mscgen-0.20/debian/patches/series 2013-12-29 04:43:25.000000000 -0800 +++ mscgen-0.20/debian/patches/series 2020-05-15 12:28:20.000000000 -0700 @@ -1 +1,2 @@ language.y-parse-param.patch +width-never-less-than-zero.patch diff -Nru mscgen-0.20/debian/patches/width-never-less-than-zero.patch mscgen-0.20/debian/patches/width-never-less-than-zero.patch --- mscgen-0.20/debian/patches/width-never-less-than-zero.patch 1969-12-31 16:00:00.000000000 -0800 +++ mscgen-0.20/debian/patches/width-never-less-than-zero.patch 2020-05-15 12:31:31.000000000 -0700 @@ -0,0 +1,23 @@ +Description: don't make width < 0 with an off-by-one fix-up + gdoTextWidth() tries to correct an off-by-one error in the calculated width + of a text bounding box; but doesn't account for the possibility that the + bounding box has a size of zero (which is the case in latest libgd for + zero-width text). Account for this so we aren't accidentally returning + -1 where we mean 0. +Author: Steve Langasek <steve.langa...@ubuntu.com> +Bug-Debian: https://bugs.debian.org/960405 +Last-Update: 2020-05-15 + +Index: mscgen-0.20/src/gd_out.c +=================================================================== +--- mscgen-0.20.orig/src/gd_out.c ++++ mscgen-0.20/src/gd_out.c +@@ -212,7 +212,7 @@ + * the right of the last character for the fixed width + * font. + */ +- return rect[2] - 1; ++ return rect[2] ? rect[2] - 1 : 0; + #endif + } +