archive/iso9660: fix off-by-one assertion failure

Calling data[fill] could trigger an assertion failure if
fill==data.size(), even if we call it only to take the address.

Instead of doing that, this commit changes the code to pointer
arithmetic.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1556
This commit is contained in:
Max Kellermann 2022-09-06 20:27:23 +02:00
parent e77b3fa46f
commit 3b05c89765

View File

@ -166,7 +166,7 @@ class Iso9660InputStream final : public InputStream {
assert(fill <= data.size());
assert(position <= fill);
return {&data[position], &data[fill]};
return {data.data() + position, data.data() + fill};
}
void Consume(size_t nbytes) noexcept {