Fix out-of-bounds read when looking for subtitles in a matroska file with no subtitles
This commit is contained in:
parent
c1f968a252
commit
dbec5ff0bc
1 changed files with 4 additions and 0 deletions
|
@ -67,6 +67,10 @@ struct MkvStdIO final : InputStream {
|
||||||
if (pos == self->file.size())
|
if (pos == self->file.size())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
auto remaining = self->file.size() - pos;
|
||||||
|
if (remaining < INT_MAX)
|
||||||
|
count = std::min(static_cast<int>(remaining), count);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
memcpy(buffer, self->file.read(pos, count), count);
|
memcpy(buffer, self->file.read(pos, count), count);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue