Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37512749
en ru br
ALT Linux repos
S:1.3.7-alt1
5.0: 1.2.0-alt3
4.1: 1.2.0-alt3.M41.1
4.0: 1.2.0-alt3
+updates:1.1.2-alt3
3.0: 1.1.1-alt2

Group :: System/Libraries
RPM: libvorbis

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: 0003-Clamp-large-exponents-in-float32_unpack.patch
Download


From 89f651faa20731cd5315e41e8920a32ebf8b87ff Mon Sep 17 00:00:00 2001
From: Thomas Daede <daede003@umn.edu>
Date: Mon, 14 May 2018 15:45:00 -0700
Subject: [PATCH] Clamp large exponents in float32_unpack.
---
 lib/sharedbook.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/sharedbook.c b/lib/sharedbook.c
index 4545d4f4..8d73daa8 100644
--- a/lib/sharedbook.c
+++ b/lib/sharedbook.c
@@ -62,7 +62,15 @@ float _float32_unpack(long val){
   int    sign=val&0x80000000;
   long   exp =(val&0x7fe00000L)>>VQ_FMAN;
   if(sign)mant= -mant;
-  return(ldexp(mant,exp-(VQ_FMAN-1)-VQ_FEXP_BIAS));
+  exp=exp-(VQ_FMAN-1)-VQ_FEXP_BIAS;
+  /* clamp excessive exponent values */
+  if (exp>63){
+    exp=63;
+  }
+  if (exp<-63){
+    exp-63;
+  }
+  return(ldexp(mant,exp));
 }
 
 /* given a list of word lengths, generate a list of codewords.  Works
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin