On 04/24/2012 08:56 PM, David Henningsson wrote:
On 04/24/2012 12:58 PM, John Spencer wrote:
the attached patch fixes an invalid long long format specifier issue (%L was used by mistake, which is the long double specifier). this lead to abort() on 64bit system, making some of the alsa-utils unusable.
Thanks very much for this patch! I'm trying to access the bug tracker but it seems to be down - could you explain a little where and how this bug manifests itself, if you have any good test case etc?
it manifests itself when a POSIX compliant C library is used (i.e. not glibc). musl libc's snprintf will return an error by detecting the invalid combination %Li
err = snprintf(res, sizeof(res), "%Li", config->u.integer64);
thus the following code is triggered
if (err< 0 || err == sizeof(res)) { assert(0); return -ENOMEM;
however, depending on how stdarg is implemented, a buggy implementation could eventually try to load a double from the floating point stack, instead of using the stack/integer registers, thus causing a crash, which would be even worse.