From c8e6f50d55ac0802a9188c3b4e8948a01ca4ad0d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 25 Jul 2018 00:01:39 +0200 Subject: [PATCH] input/buffered: fix bogus offset after Seek() Instead of copying the offset from our `input`, copy the requested offset to our `offset` attribute. By the time Seek() finishes, our input's offset may have advanced already, having read some more data, thus giving us a bogus offset. This fixes spurious decoder failues (closes #320). --- src/input/BufferedInputStream.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/input/BufferedInputStream.cxx b/src/input/BufferedInputStream.cxx index c0b6e0783..1aa5fa09c 100644 --- a/src/input/BufferedInputStream.cxx +++ b/src/input/BufferedInputStream.cxx @@ -85,7 +85,7 @@ BufferedInputStream::Seek(offset_type new_offset) if (seek_error) std::rethrow_exception(std::exchange(seek_error, {})); - offset = input->GetOffset(); + offset = new_offset; } bool