https://bugs.kde.org/show_bug.cgi?id=421565

Julius Künzel <jk.kde...@smartlab.uber.space> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|20.08.2                     |5.98.0
           Assignee|j...@kdenlive.org             |fa...@kde.org
           Severity|grave                       |critical
                 CC|                            |kdelibs-b...@kde.org
            Product|kdenlive                    |frameworks-karchive
          Component|User Interface              |general

--- Comment #20 from Julius Künzel <jk.kde...@smartlab.uber.space> ---
This was initially reported to Kdenlive, but I made some tests and I am pretty
sure this is a KArchive bug.

If you pack a large *.mp4 file into a KTar Archive, the archive will be broken.
As far as I can see, large means bigger than about 8GB. Smaller files do not
lead to broken archives.

I tried to archive the same files with Ark and everything worked fine, the
archive is not corrupted.

Here is some code that reproduces it: 

```
    std::unique_ptr<KArchive> archive;
    archive = std::make_unique<KTar>(QStringLiteral("/path/to/archive.tar.gz"),
QStringLiteral("application/x-gzip"));
    archive->open(QIODevice::WriteOnly);

    QString sourceFile = QStringLiteral("/path/to/EightDotSixGB.mp4");
    QString destinationFile = QStringLiteral("EightSixGB.mp4");

    bool success = archive->addLocalFile(sourceFile, destinationFile);
    // sucess  is true, but archive broken
    archive->close();
```

Broken means Ark show a warning when opening the archive. It is possible to
open in read only mode, but if you extract the *.mp4 only part of it can be
played.

Extracting the archive with KArchive does not work. It fails on opening:

```
    QString archiveName = QStringLiteral("/path/to/archive.tar.gz");

    KArchive *archive = new KTar(archiveName);

    if (!archive->isOpen()) {
        if (!archive->open(QIODevice::ReadOnly)) {
            qDebug() << archive->errorString();
            // we always end up here with archive->errorString()
            // "Could not read tar header"
            return;
        }
    }

    QDir dir(archiveName.remove(QStringLiteral(".tar.gz")) +
QDir::separator());
    if (!dir.mkpath(QStringLiteral("."))) {
        return;
    }

    archive->directory()->copyTo(archiveName + QDir::separator());
    archive->close();
```

KZip does also not work in a similar way. I don't know if it is the same cause
or not.  If you try to read a *.zip archive with the above code,
archive->errorString() is "Invalid ZIP file. Unrecognized header at offset
643690023" which seems somehow related to BUG: 450597

KF Version: 5.98

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to