From: Anton Mitrofanov Date: Fri, 7 Aug 2009 17:44:13 +0000 (-0700) Subject: Fix a potential infinite loop in QPfile parsing on Windows X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7dec1a1574e6b94959d9bf3e997cea146289f9a7;p=libx264 Fix a potential infinite loop in QPfile parsing on Windows ftell doesn't seem to work properly on Windows in text mode. --- 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;