imgcodecs: fix RBaseStream::setPos() outside of current block

Seeking outside of the current block doesn't update actual data,
so getByte()/etc will get wrong data from stalled buffer.
This commit is contained in:
Alexander Alekhin 2019-03-31 10:16:49 +00:00
parent 6316b3ed91
commit 6dfb6a3016

View File

@ -175,8 +175,11 @@ void RBaseStream::setPos( int pos )
}
int offset = pos % m_block_size;
int old_block_pos = m_block_pos;
m_block_pos = pos - offset;
m_current = m_start + offset;
if (old_block_pos != m_block_pos)
readBlock();
}