diff mbox

[FFmpeg-devel,v2] avformat/rmdec.c: fix left shift of negative value in rm_sync()

Message ID 20190915130208.427-1-jamrial@gmail.com
State Accepted
Commit 78f52b4fe388bb63ed2ca674f7486edc11053f70
Headers show

Commit Message

James Almer Sept. 15, 2019, 1:02 p.m. UTC
Fixes ticket 8143.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/rmdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andreas Rheinhardt Sept. 15, 2019, 1:19 p.m. UTC | #1
James Almer:
> Fixes ticket 8143.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavformat/rmdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
> index c9abd38d33..e95cc9f858 100644
> --- a/libavformat/rmdec.c
> +++ b/libavformat/rmdec.c
> @@ -724,8 +724,8 @@ static int rm_sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stre
>  
>              num = avio_rb16(pb);
>              *timestamp = avio_rb32(pb);
> -            mlti_id = (avio_r8(pb)>>1)-1<<16;
> -            mlti_id = FFMAX(mlti_id, 0);
> +            mlti_id = avio_r8((pb) >> 1) - 1;
> +            mlti_id = FFMAX(mlti_id, 0) << 16;
>              *flags = avio_r8(pb); /* flags */
>          }
>          for(i=0;i<s->nb_streams;i++) {
> 
LGTM.

- Andreas
James Almer Sept. 15, 2019, 1:34 p.m. UTC | #2
On 9/15/2019 10:19 AM, Andreas Rheinhardt wrote:
> James Almer:
>> Fixes ticket 8143.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavformat/rmdec.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
>> index c9abd38d33..e95cc9f858 100644
>> --- a/libavformat/rmdec.c
>> +++ b/libavformat/rmdec.c
>> @@ -724,8 +724,8 @@ static int rm_sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stre
>>  
>>              num = avio_rb16(pb);
>>              *timestamp = avio_rb32(pb);
>> -            mlti_id = (avio_r8(pb)>>1)-1<<16;
>> -            mlti_id = FFMAX(mlti_id, 0);
>> +            mlti_id = avio_r8((pb) >> 1) - 1;
>> +            mlti_id = FFMAX(mlti_id, 0) << 16;
>>              *flags = avio_r8(pb); /* flags */
>>          }
>>          for(i=0;i<s->nb_streams;i++) {
>>
> LGTM.
> 
> - Andreas

Applied, thanks.
diff mbox

Patch

diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index c9abd38d33..e95cc9f858 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -724,8 +724,8 @@  static int rm_sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stre
 
             num = avio_rb16(pb);
             *timestamp = avio_rb32(pb);
-            mlti_id = (avio_r8(pb)>>1)-1<<16;
-            mlti_id = FFMAX(mlti_id, 0);
+            mlti_id = avio_r8((pb) >> 1) - 1;
+            mlti_id = FFMAX(mlti_id, 0) << 16;
             *flags = avio_r8(pb); /* flags */
         }
         for(i=0;i<s->nb_streams;i++) {