[vlc-devel] [PATCH 1/2] mpg123: fix sign comparison about rate

Jean-Baptiste Kempf jb at videolan.org
Tue Aug 8 17:17:30 CEST 2017


On Tue, 8 Aug 2017, at 14:11, Rémi Denis-Courmont wrote:
> Le 8 août 2017 12:20:38 GMT+03:00, Jean-Baptiste Kempf
> <jb at videolan.org> a écrit :>> mpg123 uses long as rate...
>> 
>> ---
>> 
>>  modules/codec/mpg123.c | 4 ++--
>> 
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> 
>> 
>> diff --git a/modules/codec/mpg123.c b/modules/codec/mpg123.c
>> 
>> index d9e646cb59..171254f707 100644
>> 
>> --- a/modules/codec/mpg123.c
>> 
>> +++ b/modules/codec/mpg123.c
>> 
>> @@ -186,9 +186,9 @@ static int UpdateAudioFormat( decoder_t *p_dec )
>>>>      aout_FormatPrepare( &p_dec->fmt_out.audio );
>> 
>>  
>> 
>>      /* Date management */
>> 
>> -    if( p_dec->fmt_out.audio.i_rate != frame_info.rate )
>> 
>> +    if( p_dec->fmt_out.audio.i_rate != (unsigned
>>      int)frame_info.rate )
>>>>      {
>> 
>> -        p_dec->fmt_out.audio.i_rate = frame_info.rate;
>> 
>> +        p_dec->fmt_out.audio.i_rate = (unsigned int)frame_info.rate;
>>>>          date_Init( &p_sys->end_date, p_dec->fmt_out.audio.i_rate, 1
>>          );
>>>>          date_Set( &p_sys->end_date, 0 );
>> 
>>      }
>> 
> 
> This won't work if the rate can be larger than UINT_MAX. I don't know
> the mpg123 internals.> 
> 
> 

Max rate cannot reach UINT_MAX by 3 or 4 orders of magnitude.


--
Jean-Baptiste Kempf -  President
+33 672 704 734
 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170808/783e3dd5/attachment.html>


More information about the vlc-devel mailing list