LibRaw_QIODevice::seek() bounding checks

This commit is contained in:
Mirco Miranda 2022-09-20 19:44:08 +02:00
parent 65a20b43fc
commit d881a7bbb1

View File

@ -131,11 +131,15 @@ public:
virtual int seek(INT64 o, int whence) override
{
auto pos = o;
auto size = m_device->size();
if (whence == SEEK_CUR) {
pos = m_device->pos() + o;
}
if (whence == SEEK_END) {
pos = m_device->size() + o;
pos = size + o;
}
if (pos < 0 || pos > size) {
return -1;
}
return m_device->seek(pos) ? 0 : -1;
}