From 71506ae7a307545b530663ecab00b06fc424ca48 Mon Sep 17 00:00:00 2001 From: Anton Mitrofanov Date: Fri, 7 Aug 2009 10:44:13 -0700 Subject: [PATCH] Fix a potential infinite loop in QPfile parsing on Windows ftell doesn't seem to work properly on Windows in text mode. --- x264.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x264.c b/x264.c index 09ec7a56..74e32b7c 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; -- 2.47.3