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:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user