diff options
author | Max Kellermann <max@musicpd.org> | 2021-02-07 21:24:19 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2021-02-07 21:41:51 +0100 |
commit | e7da5b104d440940aad897567d0b54009eae4a84 (patch) | |
tree | 2ab6a3d77f7379fc6396353edc852b96995ccecc | |
parent | 4be76f3c8fd45b2bcbea661e69cf4f53588de88d (diff) |
archive/iso9660: another fix for unaligned reads
Commit 79b2366387dcd5f4ccae50eacf1ae06973f01d83 added the field `skip`
to support unaligned reads, but set the `offset` field to a wrong
value. This resulted in miscalculation of `remaining`, causing
an assertion failure.
The fix is to assign `offset` the correct value, but consider the
`skip` value in the assertion.
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1067
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | src/archive/plugins/Iso9660ArchivePlugin.cxx | 4 |
2 files changed, 4 insertions, 2 deletions
@@ -1,6 +1,8 @@ ver 0.22.5 (not yet released) * tags - id: translate TPE3 to Conductor, not Performer +* archive + - iso9660: another fix for unaligned reads * output - httpd: error handling on Windows improved diff --git a/src/archive/plugins/Iso9660ArchivePlugin.cxx b/src/archive/plugins/Iso9660ArchivePlugin.cxx index 56bf15c28..71f2ebb22 100644 --- a/src/archive/plugins/Iso9660ArchivePlugin.cxx +++ b/src/archive/plugins/Iso9660ArchivePlugin.cxx @@ -221,8 +221,8 @@ public: if (new_offset > size) throw std::runtime_error("Invalid seek offset"); + offset = new_offset; skip = new_offset % ISO_BLOCKSIZE; - offset = new_offset - skip; buffer.Clear(); } }; @@ -260,7 +260,7 @@ Iso9660InputStream::Read(std::unique_lock<Mutex> &, if (r.empty()) { /* the buffer is empty - read more data from the ISO file */ - assert(offset % ISO_BLOCKSIZE == 0); + assert((offset - skip) % ISO_BLOCKSIZE == 0); const ScopeUnlock unlock(mutex); |