[x264-devel] Fix uninitialized variable

Anton Mitrofanov git at videolan.org
Tue Jan 21 22:51:24 CET 2014


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Wed Nov 13 19:24:48 2013 +0400| [d2ed48ce17df83af8e5e1d35d1b922c9e1726006] | committer: Jason Garrett-Glaser

Fix uninitialized variable

Caused if the timebase is not specified in stats file. Found by Clang.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=d2ed48ce17df83af8e5e1d35d1b922c9e1726006
---

 encoder/ratecontrol.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index 0ed1a7b..6cd8213 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -911,7 +911,7 @@ int x264_ratecontrol_new( x264_t *h )
              * so we'll at least try to roughly approximate this effect. */
             res_factor_bits = powf( res_factor, 0.7 );
 
-            if( ( p = strstr( opts, "timebase=" ) ) && sscanf( p, "timebase=%u/%u", &k, &l ) != 2 )
+            if( !( p = strstr( opts, "timebase=" ) ) || sscanf( p, "timebase=%u/%u", &k, &l ) != 2 )
             {
                 x264_log( h, X264_LOG_ERROR, "timebase specified in stats file not valid\n" );
                 return -1;



More information about the x264-devel mailing list