mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
avutil/softfloat: Fix overflow in av_div_sf()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 277e397eb5
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
d68870a606
commit
224ed78e72
@ -109,8 +109,15 @@ static inline av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b){
|
|||||||
* @return Will not be more denormalized than a.
|
* @return Will not be more denormalized than a.
|
||||||
*/
|
*/
|
||||||
static inline av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b){
|
static inline av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b){
|
||||||
|
int64_t temp = (int64_t)a.mant * (1<<(ONE_BITS+1));
|
||||||
|
temp /= b.mant;
|
||||||
a.exp -= b.exp;
|
a.exp -= b.exp;
|
||||||
a.mant = ((int64_t)a.mant<<(ONE_BITS+1)) / b.mant;
|
a.mant = temp;
|
||||||
|
while (a.mant != temp) {
|
||||||
|
temp /= 2;
|
||||||
|
a.exp--;
|
||||||
|
a.mant = temp;
|
||||||
|
}
|
||||||
a = av_normalize1_sf(a);
|
a = av_normalize1_sf(a);
|
||||||
if (!a.mant || a.exp < MIN_EXP)
|
if (!a.mant || a.exp < MIN_EXP)
|
||||||
return FLOAT_0;
|
return FLOAT_0;
|
||||||
|
Loading…
Reference in New Issue
Block a user