mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-05-28 00:30:23 -04:00
LibRaw_QIODevice::seek() bounding checks
This commit is contained in:
parent
65a20b43fc
commit
d881a7bbb1
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user