Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-14 05:42:28 +0400
committerMichael Niedermayer <michaelni@gmx.at>2012-10-14 05:42:28 +0400
commit014b178f84fd6c5766e6a626a83f15a0dc635c90 (patch)
tree5400f65b02f0a43c6753e3893a1fc0b17cd59036 /libavcodec/g723_1.c
parent2fed05f53a881b64a02de7a324d67d8c029c6cf1 (diff)
g723_1: fix overflow in square_root()
the intermediate does not fit in a signed 32bit int Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/g723_1.c')
-rw-r--r--libavcodec/g723_1.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c
index 29eb4fae2c..017ecc41c4 100644
--- a/libavcodec/g723_1.c
+++ b/libavcodec/g723_1.c
@@ -226,8 +226,10 @@ static int unpack_bitstream(G723_1_Context *p, const uint8_t *buf,
/**
* Bitexact implementation of sqrt(val/2).
*/
-static int16_t square_root(int val)
+static int16_t square_root(unsigned val)
{
+ av_assert2(!(val & 0x80000000));
+
return (ff_sqrt(val << 1) >> 1) & (~1);
}