summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--stream/stream_libarchive.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/stream/stream_libarchive.c b/stream/stream_libarchive.c
index bb25c6ad84..119af8eea4 100644
--- a/stream/stream_libarchive.c
+++ b/stream/stream_libarchive.c
@@ -432,8 +432,15 @@ static int archive_entry_seek(stream_t *s, int64_t newpos)
int size = MPMIN(newpos - s->pos, sizeof(buffer));
locale_t oldlocale = uselocale(p->mpa->locale);
int r = archive_read_data(p->mpa->arch, buffer, size);
- if (r < 0) {
- MP_ERR(s, "%s\n", archive_error_string(p->mpa->arch));
+ if (r <= 0) {
+ if (r == 0 && newpos > p->entry_size) {
+ MP_ERR(s, "demuxer trying to seek beyond end of archive "
+ "entry\n");
+ } else if (r == 0) {
+ MP_ERR(s, "end of archive entry reached while seeking\n");
+ } else {
+ MP_ERR(s, "%s\n", archive_error_string(p->mpa->arch));
+ }
uselocale(oldlocale);
if (mp_archive_check_fatal(p->mpa, r)) {
mp_archive_free(p->mpa);