mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Fix crash when importing compressed zip files
The bug was introduced by #4751 when QScopedPointer was replaced by std::unique_ptr but release() was not called to replace take().
This commit is contained in:
@@ -514,7 +514,7 @@ void ZipReaderPrivate::scanFiles()
|
|||||||
int num_dir_entries = 0;
|
int num_dir_entries = 0;
|
||||||
EndOfDirectory eod;
|
EndOfDirectory eod;
|
||||||
while (start_of_directory == -1) {
|
while (start_of_directory == -1) {
|
||||||
int pos = device->size() - sizeof(EndOfDirectory) - i;
|
size_t pos = device->size() - sizeof(EndOfDirectory) - i;
|
||||||
if (pos < 0 || i > 65535) {
|
if (pos < 0 || i > 65535) {
|
||||||
qWarning() << "QZip: EndOfDirectory not found";
|
qWarning() << "QZip: EndOfDirectory not found";
|
||||||
return;
|
return;
|
||||||
@@ -755,7 +755,7 @@ ZipReader::ZipReader(const QString &archive, QIODevice::OpenMode mode)
|
|||||||
status = FileError;
|
status = FileError;
|
||||||
}
|
}
|
||||||
|
|
||||||
d = new ZipReaderPrivate(&(*f), /*ownDevice=*/true);
|
d = new ZipReaderPrivate(&(*f.release()), /*ownDevice=*/true);
|
||||||
d->status = status;
|
d->status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1039,7 +1039,7 @@ ZipWriter::ZipWriter(const QString &fileName, QIODevice::OpenMode mode)
|
|||||||
status = ZipWriter::FileError;
|
status = ZipWriter::FileError;
|
||||||
}
|
}
|
||||||
|
|
||||||
d = new ZipWriterPrivate(&(*f), /*ownDevice=*/true);
|
d = new ZipWriterPrivate(&(*f.release()), /*ownDevice=*/true);
|
||||||
d->status = status;
|
d->status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user