intreadwrite.h: fix AV_RL32/AV_RB32 signedness.

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 <rsbultje@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
pull/2/head
Uoti Urpala 14 years ago committed by Anton Khirnov
parent aa15e68721
commit c98b928fa7
  1. 4
      libavutil/intreadwrite.h

@ -230,7 +230,7 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
#ifndef AV_RB32 #ifndef AV_RB32
# define AV_RB32(x) \ # 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))[1] << 16) | \
(((const uint8_t*)(x))[2] << 8) | \ (((const uint8_t*)(x))[2] << 8) | \
((const uint8_t*)(x))[3]) ((const uint8_t*)(x))[3])
@ -246,7 +246,7 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
#ifndef AV_RL32 #ifndef AV_RL32
# define AV_RL32(x) \ # 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))[2] << 16) | \
(((const uint8_t*)(x))[1] << 8) | \ (((const uint8_t*)(x))[1] << 8) | \
((const uint8_t*)(x))[0]) ((const uint8_t*)(x))[0])

Loading…
Cancel
Save