[FFmpeg-devel] [PATCH] af_pan: Fix sscanf formats to work with buggy sscanf implementations

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri Sep 14 19:24:41 CEST 2012


On Fri, Sep 14, 2012 at 12:45:34PM -0400, Derek Buitenhuis wrote:
> From: Hendrik Leppkes <h.leppkes at gmail.com>
> 
> Some implementations of sscanf do not handle a space before a trailing %n
> properly.
> 
> As an example, MSVC's does this for the second insatnce in this patch, for
> an input of "0x3:c0=c1:c1=c0":
>     1) Match the final "c0" or "c1".
>     2) Realize it's at the end of the string.
>     3) Check for %n.
>     4) There is no %n, but a space instead.
>     5) Leave 'len' unitilialized.
> 
> So, move it out of the sscanf format strings, and call skip_spaces instead.

I think this should be documented somewhere or sooner or later someone
will "optimize" it back to what it was before.
At least as important, since it's easy to do it should be added to
patcheck, because I don't think anyone will remember to review for
such an obscure bug.


More information about the ffmpeg-devel mailing list