Message ID | 20190514084949.57498-2-andreas.rheinhardt@gmail.com |
---|---|
State | New |
Headers | show |
On Tue, May 14, 2019 at 10:49:49AM +0200, Andreas Rheinhardt wrote: > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> > --- > libavformat/aviobuf.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) do you have some testcase for this ? thanks [...]
Michael Niedermayer: > On Tue, May 14, 2019 at 10:49:49AM +0200, Andreas Rheinhardt wrote: >> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> >> --- >> libavformat/aviobuf.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) > > do you have some testcase for this ? > > thanks > Honestly, no. I just read the code. (Btw: Thinking of the bigger picture, there is something even weirder: If an error happens (i.e. an AVIOContext's error is set) and one performs a successfull seek, then error will still be set, yet eof_reached will be cleared, although the latter is supposed to be always set when error is set, isn't it? The same thing can happen when one calls avio_feof on the AVIOContext.) - Andreas
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 5c01423a2e..2462b95b16 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -293,8 +293,11 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) (!s->direct || !s->seek)) { while(s->pos < offset && !s->eof_reached) fill_buffer(s); - if (s->eof_reached) + if (s->eof_reached) { + if (s->error) + return s->error; return AVERROR_EOF; + } s->buf_ptr = s->buf_end - (s->pos - offset); } else if(!s->write_flag && offset1 < 0 && -offset1 < buffer_size>>1 && s->seek && offset > 0) { int64_t res;
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- libavformat/aviobuf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)