De: "Miguel A. Colón Vélez"
Objet: Bug#792672: Assertion error in meters.lv2

Package: x42-plugins
Version: 20150702-1

Hello:

Someone at the #debian-multimedia channel dropped this report

<olinuxx> Hi guys, I've a bug to report against x42-plugins
<olinuxx> the meters, both as LV2 or standalone app (x42-meter) who
are normaly displaying a needle are segfaulting
<olinuxx> using them in ardour crash it
<olinuxx> the error log is : x42-meter: ./gui/needle.c:118: void
img2surf(const MyGimpImage*, cairo_surface_t**, unsigned char**):
Assertion `ys + xs < (img->width * img->height +
img->bytes_per_pixel)' failed.
<olinuxx> (you can get it trying "x42-meter 6" as an example)
<olinuxx> this is the case with a fresh Jessie install with the
backport from stretch, as well as a fresh Stretch install
<olinuxx> I didn't looked deep yet into BTS reporting, so I'm putting
that here, hopefully, someone will pick it up

I looked at the source and the fix is trivial. It should be "*" and
not "+" as in:
-assert (ys + xs < (img->width * img->height + img->bytes_per_pixel));
+assert (ys + xs < (img->width * img->height * img->bytes_per_pixel));

ys + xs is a sequence that accumulates the total number of bytes and it goes

img->bytes_per_pixel, img->bytes_per_pixel*1, img->bytes_per_pixel*2, ...
img->bytes_per_pixel*(img->width * img->height -1)

It seems upstream wanted to bound ys + xs by the next value in the
sequence which is (img->width * img->height * img->bytes_per_pixel).
This makes the assertion always true since it will be short of the
upper bound by at least img->bytes_per_pixel.

Upstream's commit suggest that there may be another issue
https://github.com/x42/meters.lv2/commit/70497bb8b77aa5ddf13801b0a1472525cfbe42e7
with array boundaries but that is independent of this report.

I have never run or compiled  these plugins but the math seems to add
up. Hope my pseudo-patch helps.

Cheers,
Miguel

_______________________________________________
pkg-multimedia-maintainers mailing list
pkg-multimedia-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers



Hi all (olinuxx here),

I've been talking with Robin Gareus (upstream) over IRC today. He's copied to this email.

The outcomes is : the lines "assert..." can be totally removed and have beendone so upstream : https://github.com/x42/meters.lv2/commit/a52aca646c18d0356c9ed81f8721f594e3ef13bc

As well, Robin suggested to remove the fast-math optimisation (debian/rules) since (quoting Robin) :
ffast-math is not good
that can result in the meters being wrong by half a dB or so.  depends
-ffast-math     don't care about accuracy, be fast.
and with small numbers there can be a discrepancy then convert to dB and it'll be even larger

I rebuild the package on my computer using the debian sources and pbuilder and it looks to be doing the job, ie: not segfaulting anymore.

Hope this email helps and thanks to you all for the jobs done.
Cheers.
Olivier

_______________________________________________
pkg-multimedia-maintainers mailing list
pkg-multimedia-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers

Reply via email to