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>
| ... | ... |
@@ -229,11 +229,11 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
|
| 229 | 229 |
#endif |
| 230 | 230 |
|
| 231 | 231 |
#ifndef AV_RB32 |
| 232 |
-# define AV_RB32(x) \ |
|
| 233 |
- ((((const uint8_t*)(x))[0] << 24) | \ |
|
| 234 |
- (((const uint8_t*)(x))[1] << 16) | \ |
|
| 235 |
- (((const uint8_t*)(x))[2] << 8) | \ |
|
| 236 |
- ((const uint8_t*)(x))[3]) |
|
| 232 |
+# define AV_RB32(x) \ |
|
| 233 |
+ (((uint32_t)((const uint8_t*)(x))[0] << 24) | \ |
|
| 234 |
+ (((const uint8_t*)(x))[1] << 16) | \ |
|
| 235 |
+ (((const uint8_t*)(x))[2] << 8) | \ |
|
| 236 |
+ ((const uint8_t*)(x))[3]) |
|
| 237 | 237 |
#endif |
| 238 | 238 |
#ifndef AV_WB32 |
| 239 | 239 |
# define AV_WB32(p, d) do { \
|
| ... | ... |
@@ -245,11 +245,11 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
|
| 245 | 245 |
#endif |
| 246 | 246 |
|
| 247 | 247 |
#ifndef AV_RL32 |
| 248 |
-# define AV_RL32(x) \ |
|
| 249 |
- ((((const uint8_t*)(x))[3] << 24) | \ |
|
| 250 |
- (((const uint8_t*)(x))[2] << 16) | \ |
|
| 251 |
- (((const uint8_t*)(x))[1] << 8) | \ |
|
| 252 |
- ((const uint8_t*)(x))[0]) |
|
| 248 |
+# define AV_RL32(x) \ |
|
| 249 |
+ (((uint32_t)((const uint8_t*)(x))[3] << 24) | \ |
|
| 250 |
+ (((const uint8_t*)(x))[2] << 16) | \ |
|
| 251 |
+ (((const uint8_t*)(x))[1] << 8) | \ |
|
| 252 |
+ ((const uint8_t*)(x))[0]) |
|
| 253 | 253 |
#endif |
| 254 | 254 |
#ifndef AV_WL32 |
| 255 | 255 |
# define AV_WL32(p, d) do { \
|