KCompressionDevice::seek: Fix previous fix ^_^
ClosedPublic

Authored by aacid on May 26 2019, 5:51 PM.

Details

Summary

The previous fix that made sure we returned the actual data in KCompressionDevice::readData
because it is sometimes buffered, didn't take into account this line

QByteArray dummy(qMin(bytesToRead, qint64(SEEK_BUFFER_SIZE)), 0);

in KCompressionDevice::seek, i.e. sometimes the dummy buffer is not as big as we need to seek,
basically because we don't want to be allocating lots of memory.

The previous solution worked because never incremented the data pointer, that meant that the
internal QIODevice buffer might end in a bad state, so we fixed it but forgot about the case
where the dummy buffer we're using is not big enough and this was causing invalid memory writes.

To fix that now we have a while loop that reads as many times over the dummy buffer to seek
to the correct position.

Comes with an extended autottest, that has a big buffer and without this fix would crash.

Diff Detail

Repository
R243 KArchive
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 12176
Build 12194: arc lint + arc unit
aacid created this revision.May 26 2019, 5:51 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptMay 26 2019, 5:51 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
aacid requested review of this revision.May 26 2019, 5:51 PM
apol accepted this revision.May 26 2019, 11:09 PM
This revision is now accepted and ready to land.May 26 2019, 11:09 PM
aacid closed this revision.May 27 2019, 7:19 AM