[FFmpeg-devel] [PATCH] audioconvert: make av_get_channel_layout accept composite names.

Nicolas George nicolas.george at normalesup.org
Tue Nov 8 15:37:50 CET 2011

Le septidi 17 brumaire, an CCXX, Stefano Sabatini a écrit :
> maybe long int for avoiding possible warnings/problems with strtol

We have strtol()s stored into ints all over the place, nobody seems to
really care.

I do not think that ffmpeg would work on anything where integer overflows
would cause anything silly, so as long as we do not trust the result to be
in a certain range without validation, we are good.

av_get_default_channel_layout has no problem in that regard, and frankly, if
on some architectures and/or libc implementations "180388626434" is a
synonym for "stereo", I can live with it.

> you may want a range check to make sure that the long long int can be
> contained in an int64_t if you want to be perfectly safe

I changed it like that in my working tree:

	return FFMAX(layout, 0);

to avoid negatives results (I can not fathom why channels layout were not
unsigned in the first place), but otherwise, same as above: if
"0x420000000000000003" is treated as a synonym for "stereo", I can live with
that: that is just the user being silly and getting not-so-silly results,
and it can not lead to a security problem.

>							   (I'm assuming
> that long long int can contain an int64_t without checking the fine
> specs).

I confirm it can.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111108/6974a464/attachment.asc>

More information about the ffmpeg-devel mailing list