[FFmpeg-devel] intent of 'lsf' variable in libavformat/mp3enc.c mp3_write_xing() ?
Jason Vas Dias
jason.vas.dias at synchronoss.com
Thu Jun 19 15:51:33 CEST 2014
Good day -
I am building ffmpeg, and fixing this compiler warning :
libavformat/mp3enc.c:164: warning: 'lsf' may be used uninitialized in this function
The line in question and variable declaration is :
line 127: int bytes_needed, lsf;
...
line 164: int bit_rate = 1000 * avpriv_mpa_bitrate_tab[lsf][3 - 1][bitrate_idx];
There are no uses of 'lsf' between lines 127 & 164.
I'm assuming the intent of this is :
line 164: int bit_rate = 1000 * avpriv_mpa_bitrate_tab[ 0 ][3 - 1][bitrate_idx];
^^^
ie. the use of lsf here should be replaced by 0.
Or was 'lsf' intended to be initialized from mpah.lsf, initialized & used later on in the function ?
The current situation is definitely a bug in waiting, as the lsf index could be initialized to any
garbage value and the avpriv_mpa_bitrate_tab bounds could be exceeded.
Sorry for this newbie question - any responses gratefully received.
Thanks & Regards,
Jason Vas Dias
More information about the ffmpeg-devel
mailing list