On Wed, 2012-08-01 at 21:22 +0100, Måns Rullgård wrote:
> >>> +int snprintf(char *buffer, size_t bufsize, const char *fmt, ...)

> >>> +    if ((int)bufsize <= 0) return -1;

> If bufsize > INT_MAX, that cast has unspecified behaviour.

No, it's implementation-defined (you're probably confusing it with
arithmetic, but casts are not he same).

BTW I wonder what perfectly standard-conforming snprintf is supposed to
do with huge sizes. The size limit has type size_t, but the return value
has type int, and is documented as "the number of characters that would
have been written had n been sufficiently large, not counting the
terminating null character, or a negative value if an encoding error
occurred". What if there was no encoding error, but the number of
characters was more than INT_MAX?


_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to