diff options
author | Mans Rullgard <mans@mansr.com> | 2011-11-27 14:29:33 +0400 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2011-11-27 14:30:16 +0400 |
commit | d9ba767d615ffb1f51ac3f990c51768ea8622da8 (patch) | |
tree | d20e5e8be1a17e02280bb603d487e974115fdb0c /libavformat/mpc.c | |
parent | 028a2375e25d66d1f927f8a0b531eaaf6642cf5c (diff) |
musepack: fix signed shift overflow in mpc_read_packet()
Using an unsigned variable avoids problems with overflows.
There is further no need for a 64-bit intermediate here.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavformat/mpc.c')
-rw-r--r-- | libavformat/mpc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/mpc.c b/libavformat/mpc.c index a8f526a627..a67d9ae218 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -117,7 +117,8 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) { MPCContext *c = s->priv_data; int ret, size, size2, curbits, cur = c->curframe; - int64_t tmp, pos; + unsigned tmp; + int64_t pos; if (c->curframe >= c->fcount && c->fcount) return -1; @@ -134,8 +135,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) if(curbits <= 12){ size2 = (tmp >> (12 - curbits)) & 0xFFFFF; }else{ - tmp = (tmp << 32) | avio_rl32(s->pb); - size2 = (tmp >> (44 - curbits)) & 0xFFFFF; + size2 = (tmp << (curbits - 12) | avio_rl32(s->pb) >> (44 - curbits)) & 0xFFFFF; } curbits += 20; avio_seek(s->pb, pos, SEEK_SET); |