From b9430309ec69e853add16c60e078710f5fc4052b Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 17 Aug 2017 17:29:17 +0200 Subject: stream: add an assert() to an obscure seek case This affects small seeks backwards while within the buffer. Demuxers usually avoid this, so it's probably not triggered very often. (Although demux_mkv.c potentially triggers it often, and it uses stream_peek() to explicitly guarantee that it can use this code to seek back.) The condition is complex enough to warrant an assertion. --- stream/stream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/stream/stream.c b/stream/stream.c index ca17fa787f..29234e59a5 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -563,6 +563,7 @@ bool stream_seek(stream_t *s, int64_t pos) int64_t x = pos - (s->pos - (int)s->buf_len); if (x >= 0) { s->buf_pos = x; + assert(s->buf_pos <= s->buf_len); return true; } } -- cgit v1.2.3