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

            Bug ID: 437778
           Summary: KArchiveFile data() returns less data then size()
           Product: frameworks-karchive
           Version: 5.73.0
          Platform: Other
                OS: Other
            Status: REPORTED
          Severity: major
          Priority: NOR
         Component: general
          Assignee: fa...@kde.org
          Reporter: koen.po...@vandewiele.com
                CC: kdelibs-b...@kde.org
  Target Milestone: ---

SUMMARY
data() and size() aren't consistent: the data() contains less bytes than
indicated by size() for file 1 in this archive.

CODE TO REPRODUCE

KZip zip("datalessthansize.zip"); // see below
zip.open(QIODevice::ReadOnly);
auto dir = zip.directory();
auto dir1 = dir->entry("dir1");

const KArchiveFile *file1 = dir1->file("file1");
const QByteArray data1 = file1->data();
qDebug() << "file1" << file1->position() << file1->size() << data1.size();

const KArchiveFile *file2 = dir1->file("file2");
const QByteArray data2 = file2->data();
qDebug() << "file2" << file2->position() << file2->size() << data2.size();


OBSERVED RESULT
      position()   size()   data().size() 
file1         68  5757690   <=    5750784 ???
file2    5758706   566784          566784


EXPECTED RESULT
      position()   size()   data().size() 
file1         68  5757690         5757690
file2    5758706   566784          566784


SOFTWARE/OS VERSIONS
Linux 5.4.90-intel-pk-standard x86_64
Qt Version: 5.15

ADDITIONAL INFORMATION
Not seen with 5.30 on x86 platform.

Creating the test archive (6MB is too much for an attachment)

mkdir dir1
head -c 5757690 < /dev/urandom > dir1/file1
head -c  566784 < /dev/urandom > dir1/file2
zip datalessthansize.zip dir1/file1 dir1/file2

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

Reply via email to