"Ronald S. Bultje" <[email protected]> writes:

> From: Uoti Urpala <[email protected]>
>
> The output type of the AV_RL32/AV_RB32 macros was signed int. The
> resulting overflow broke at least some ASF streams with large
> timestamps. Fix by adding a cast to uint32_t.
>
> Signed-off-by: Ronald S. Bultje <[email protected]>
> ---
>  libavutil/intreadwrite.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h
> index c8489f1..ea0cc82 100644
> --- a/libavutil/intreadwrite.h
> +++ b/libavutil/intreadwrite.h
> @@ -230,7 +230,7 @@ union unaligned_16 { uint16_t l; } 
> __attribute__((packed)) av_alias;
>
>  #ifndef AV_RB32
>  #   define AV_RB32(x)                           \
> -    ((((const uint8_t*)(x))[0] << 24) |         \
> +    ((uint32_t)(((const uint8_t*)(x))[0] << 24) |\
>       (((const uint8_t*)(x))[1] << 16) |         \
>       (((const uint8_t*)(x))[2] <<  8) |         \
>        ((const uint8_t*)(x))[3])
> @@ -246,7 +246,7 @@ union unaligned_16 { uint16_t l; } 
> __attribute__((packed)) av_alias;
>
>  #ifndef AV_RL32
>  #   define AV_RL32(x)                           \
> -    ((((const uint8_t*)(x))[3] << 24) |         \
> +    ((uint32_t)(((const uint8_t*)(x))[3] << 24) |\
>       (((const uint8_t*)(x))[2] << 16) |         \
>       (((const uint8_t*)(x))[1] <<  8) |         \
>        ((const uint8_t*)(x))[0])

Please try to format it in a less ugly way.

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to