[FFmpeg-cvslog] ffv1: avoid checking a double for equality

Michael Niedermayer git at videolan.org
Sat Oct 13 01:55:36 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Oct 13 01:47:31 2012 +0200| [54b2d317ed99622efa07b10aca217e1a083105d9] | committer: Michael Niedermayer

ffv1: avoid checking a double for equality

if 0.0 != 0.0 a out of array read would occur, equal checks
with floating point may behave in such odd ways, though
this is very unlikely in a real implementation of a compiler

Fixes: CID718936
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=54b2d317ed99622efa07b10aca217e1a083105d9
---

 libavcodec/ffv1.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index a09644e..7787070 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -275,7 +275,7 @@ static void find_best_state(uint8_t best_state[256][256], const uint8_t one_stat
             occ[j]=1.0;
             for(k=0; k<256; k++){
                 double newocc[256]={0};
-                for(m=0; m<256; m++){
+                for(m=1; m<256; m++){
                     if(occ[m]){
                         len -=occ[m]*(     p *l2tab[    m]
                                       + (1-p)*l2tab[256-m]);



More information about the ffmpeg-cvslog mailing list