diff options
author | Paul B Mahol <onemda@gmail.com> | 2019-09-25 18:01:09 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2019-09-25 18:01:09 +0200 |
commit | 1a17a66b09899fabde52c06cadd985003bcd1965 (patch) | |
tree | d845b51c7328880ebd105a6e979f746267b66317 /libavformat/sdsdec.c | |
parent | d58752bcb923f48d372c0377c07990dd6379a1a9 (diff) | |
download | ffmpeg-1a17a66b09899fabde52c06cadd985003bcd1965.tar.gz |
avformat/sdsdec: fix undefined behaviour
Fixes #8163, #8164, #8165.
Diffstat (limited to 'libavformat/sdsdec.c')
-rw-r--r-- | libavformat/sdsdec.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/sdsdec.c b/libavformat/sdsdec.c index 9c361cdff2..c70f5af849 100644 --- a/libavformat/sdsdec.c +++ b/libavformat/sdsdec.c @@ -43,7 +43,7 @@ static void byte2_read(const uint8_t *src, uint32_t *dst) int i; for (i = 0; i < 120; i += 2) { - unsigned sample = (src[i + 0] << 25) + (src[i + 1] << 18); + unsigned sample = ((unsigned)src[i + 0] << 25) + ((unsigned)src[i + 1] << 18); dst[i / 2] = sample; } @@ -56,7 +56,7 @@ static void byte3_read(const uint8_t *src, uint32_t *dst) for (i = 0; i < 120; i += 3) { unsigned sample; - sample = (src[i + 0] << 25) | (src[i + 1] << 18) | (src[i + 2] << 11); + sample = ((unsigned)src[i + 0] << 25) | ((unsigned)src[i + 1] << 18) | ((unsigned)src[i + 2] << 11); dst[i / 3] = sample; } } @@ -68,7 +68,7 @@ static void byte4_read(const uint8_t *src, uint32_t *dst) for (i = 0; i < 120; i += 4) { unsigned sample; - sample = (src[i + 0] << 25) | (src[i + 1] << 18) | (src[i + 2] << 11) | (src[i + 3] << 4); + sample = ((unsigned)src[i + 0] << 25) | ((unsigned)src[i + 1] << 18) | ((unsigned)src[i + 2] << 11) | ((unsigned)src[i + 3] << 4); dst[i / 4] = sample; } } |