[Bug 264442] audio/sox: Several crashes (SIGABRT, SIGBUS, SIGSEGV) when reading mp3

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 04 Jun 2022 01:26:42 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264442

--- Comment #4 from Dan Nelson <dnelson_1901@yahoo.com> ---
(In reply to Benjamin Stoker from comment #0)

This looks like a bug in libmad, where it internally defines a mad_fixed_t type
as long, but in the public header that it installs, defines it as an int.

Reverting to libmad-0.15.1b_7 seems to make it work again for me.

The underlying problem is that there's a fixed.h file in the libmad source with
this block:

 # if SIZEOF_INT >= 4
 typedef   signed int mad_fixed_t;

 typedef   signed int mad_fixed64hi_t;
 typedef unsigned int mad_fixed64lo_t;
 # else
 typedef   signed long mad_fixed_t;

 typedef   signed long mad_fixed64hi_t;
 typedef unsigned long mad_fixed64lo_t;
 # endif

, but SIZEOF_INT isn't defined in that header.  It's defined in mad.h.in ,
which is installed as mad.h for other tools to use:

 # define SIZEOF_INT 4
 # define SIZEOF_LONG 4
 # define SIZEOF_LONG_LONG 8

A workaround might be to copy those defines into fixed.h so that the types
inside libmad.so match the installed header.  The real fix, imho,  would be to
get rid of all the SIZEOF defines and just use the standard int32_t/uint32_t
types if a 32-bit variable is required.  The defines aren't even generated by
the config process - they're hardcoded, so it will probably break on other
architectures.

-- 
You are receiving this mail because:
You are the assignee for the bug.