mirror of https://github.com/mpv-player/mpv
ffmpeg_files/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 (AV_RL32 used in demux_asf.c timestamp parsing code). Fix by adding a cast to uint32_t. This code comes from FFmpeg, and the matching code in Libav/FFmpeg is still broken (but not used there in most common configurations).
This commit is contained in:
parent
378ada847c
commit
6d187a73f0
|
@ -44,7 +44,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef AV_RB32
|
#ifndef AV_RB32
|
||||||
#define AV_RB32(x) ((((const uint8_t*)(x))[0] << 24) | \
|
#define AV_RB32(x) (((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])
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef AV_RL32
|
#ifndef AV_RL32
|
||||||
#define AV_RL32(x) ((((const uint8_t*)(x))[3] << 24) | \
|
#define AV_RL32(x) (((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…
Reference in New Issue