[x264-devel] commit: Fix a potential infinite loop in QPfile parsing on Windows ( Anton Mitrofanov )

git version control git at videolan.org
Sat Aug 8 04:34:37 CEST 2009


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Fri Aug  7 10:44:13 2009 -0700| [71506ae7a307545b530663ecab00b06fc424ca48] | committer: Jason Garrett-Glaser 

Fix a potential infinite loop in QPfile parsing on Windows
ftell doesn't seem to work properly on Windows in text mode.

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

 x264.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/x264.c b/x264.c
index 09ec7a5..74e32b7 100644
--- a/x264.c
+++ b/x264.c
@@ -781,7 +781,7 @@ static int  Parse( int argc, char **argv,
                 }
                 break;
             case OPT_QPFILE:
-                opt->qpfile = fopen( optarg, "r" );
+                opt->qpfile = fopen( optarg, "rb" );
                 if( !opt->qpfile )
                 {
                     fprintf( stderr, "x264 [error]: can't open `%s'\n", optarg );
@@ -1036,7 +1036,7 @@ static void parse_qpfile( cli_opt_t *opt, x264_picture_t *pic, int i_frame )
 			fseek( opt->qpfile , file_pos , SEEK_SET );
 			break;
 		}
-        if( num < i_frame )
+        if( num < i_frame && ret == 3 )
             continue;
         pic->i_qpplus1 = qp+1;
         if     ( type == 'I' ) pic->i_type = X264_TYPE_IDR;



More information about the x264-devel mailing list