ff_gen_search: fix infinite loop
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 18 Jun 2013 18:50:15 +0000 (20:50 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 18 Jun 2013 20:53:00 +0000 (22:53 +0200)
Fixes Ticket2639

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/utils.c

index 686374d..ce92af6 100644 (file)
@@ -1778,7 +1778,7 @@ int64_t ff_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts,
             pos_max = FFMAX(0, pos_max - step);
             ts_max = ff_read_timestamp(s, stream_index, &pos_max, limit, read_timestamp);
             step += step;
-        }while(ts_max == AV_NOPTS_VALUE && pos_max > 0);
+        }while(ts_max == AV_NOPTS_VALUE && 2*limit > step);
         if (ts_max == AV_NOPTS_VALUE)
             return -1;