summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-07-01 20:29:44 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-07-01 20:30:48 +0200
commitce81e47c911fcff4f006b3b14b40a396eaa77696 (patch)
treee46719e297d363bc35fee93d7b44e81116545648
parentf8e038f9a07d9539e7ffa23dc9f7505dc15c8fa2 (diff)
downloadffmpeg-streaming-ce81e47c911fcff4f006b3b14b40a396eaa77696.zip
ffmpeg-streaming-ce81e47c911fcff4f006b3b14b40a396eaa77696.tar.gz
avcodec/mss2: Fix integer overflow
This also simplifies the code Fixes: signal_sigabrt_7ffff6ac8cc9_2943_cov_3588637614_mss2_speech.wmv Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/mss2.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c
index f57685d..f788143 100644
--- a/libavcodec/mss2.c
+++ b/libavcodec/mss2.c
@@ -52,9 +52,9 @@ static void arith2_normalise(ArithCoder *c)
c->value ^= 0x8000;
c->low ^= 0x8000;
}
- c->high = c->high << 8 & 0xFFFFFF | 0xFF;
- c->value = c->value << 8 & 0xFFFFFF | bytestream2_get_byte(c->gbc.gB);
- c->low = c->low << 8 & 0xFFFFFF;
+ c->high = (uint16_t)c->high << 8 | 0xFF;
+ c->value = (uint16_t)c->value << 8 | bytestream2_get_byte(c->gbc.gB);
+ c->low = (uint16_t)c->low << 8;
}
}
OpenPOWER on IntegriCloud