archive/iso9660: another fix for unaligned reads
Commit 79b2366387
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
This commit is contained in:
parent
4be76f3c8f
commit
e7da5b104d
2
NEWS
2
NEWS
|
@ -1,6 +1,8 @@
|
||||||
ver 0.22.5 (not yet released)
|
ver 0.22.5 (not yet released)
|
||||||
* tags
|
* tags
|
||||||
- id: translate TPE3 to Conductor, not Performer
|
- id: translate TPE3 to Conductor, not Performer
|
||||||
|
* archive
|
||||||
|
- iso9660: another fix for unaligned reads
|
||||||
* output
|
* output
|
||||||
- httpd: error handling on Windows improved
|
- httpd: error handling on Windows improved
|
||||||
|
|
||||||
|
|
|
@ -221,8 +221,8 @@ public:
|
||||||
if (new_offset > size)
|
if (new_offset > size)
|
||||||
throw std::runtime_error("Invalid seek offset");
|
throw std::runtime_error("Invalid seek offset");
|
||||||
|
|
||||||
|
offset = new_offset;
|
||||||
skip = new_offset % ISO_BLOCKSIZE;
|
skip = new_offset % ISO_BLOCKSIZE;
|
||||||
offset = new_offset - skip;
|
|
||||||
buffer.Clear();
|
buffer.Clear();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -260,7 +260,7 @@ Iso9660InputStream::Read(std::unique_lock<Mutex> &,
|
||||||
if (r.empty()) {
|
if (r.empty()) {
|
||||||
/* the buffer is empty - read more data from the ISO file */
|
/* 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);
|
const ScopeUnlock unlock(mutex);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue