Example code:

int main()
{
    array x=({
        ({128,0,"TiMidity","TiMidity port 0"}),
        ({128,1,"TiMidity","TiMidity port 1"}),
    });
    write("Ports available:\n%{%3d:%-3d  %-32.32s %s\n%}",x);
}

In the latest Pikes, this may segfault or produce horribly wrong data;
a --with-debug build emits a fatal "sprintf: fs->fsp incorrect after
recursive sprintf.". Bisecting a non-debug build pointed to 7fdf94 as
the crash culprit, but I couldn't replicate that bisection on a debug
build for some reason (the build didn't finish for several commits).

The problem seems to occur when %{ %} results in a reallocation of the
format_info_stack at the top of low_pike_sprintf (sprintf.c:1026).
There's a ptrdiff_t that doesn't seem to be used anywhere, and which
could be connected. I'm not sure why 7fdf94 should bring in the
problem, though, as it looks like a direct - almost mechanical -
translation.

ChrisA

Reply via email to