1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-23 15:40:42 +00:00

Merge branch 'thismoviesucks' into 'master'

Don't break the read_packet contract

Closes #8153

See merge request OpenMW/openmw!4378
This commit is contained in:
AnyOldName3 2024-09-20 00:30:26 +00:00
commit 224b9f0692

View File

@ -236,11 +236,17 @@ int VideoState::istream_read(void *user_data, uint8_t *buf, int buf_size)
std::istream& stream = *static_cast<VideoState*>(user_data)->stream;
stream.clear();
stream.read((char*)buf, buf_size);
return stream.gcount();
if (stream.bad())
return AVERROR_UNKNOWN;
auto count = stream.gcount();
// avio_alloc_context says we mustn't return 0 for stream protocols
if (!count)
return AVERROR_EOF;
return count;
}
catch (std::exception& )
{
return 0;
return AVERROR_UNKNOWN;
}
}