avformat/aviobuf: Allow seeking to the end of the buffer for read only buffers
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 28 Jan 2015 19:55:42 +0000 (20:55 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 28 Jan 2015 19:56:50 +0000 (20:56 +0100)
This undoes the effect of 3c18a7b18807de81566381a1bcbe9f6103c0296b for reading

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

index 6a1f83acba624316082d3e17f4d795188b949417..3d77a7ff25427b3ab08fb111fa50b9986cac0a03 100644 (file)
@@ -228,7 +228,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
 
     offset1 = offset - pos;
     if (!s->must_flush && (!s->direct || !s->seek) &&
-        offset1 >= 0 && offset1 < buffer_size) {
+        offset1 >= 0 && offset1 <= buffer_size - s->write_flag) {
         /* can do the seek inside the buffer */
         s->buf_ptr = s->buffer + offset1;
     } else if ((!s->seekable ||