Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-111858

QFileInfo.Size() may return a different size for some crafted filename.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • None
    • 5.15.2, 6.4.2
    • Core: I/O
    • None

    Description

      (First, sorry if i assign wrong Component).

      The bug happened on Qt Core 5.15.2 (my company application on multiple platform Windows/Linux/Mac), and Qt 6.4.2 using Qt creator for reproduce the bug:

       

      (Qt 6.4.2 (x86_64-little_endian-llp64 shared (dynamic) release build; by MSVC 2019) on "windows"
      • On both Windows and Linux, when a file have "\u00FFFF" or "\u0FFFFF" in its name, no matter it is the first/ only character or between other characters, size() always return 0 for the file, despite the real size of it.

      reproduce:

       

      step 1: renaming file with "\u0ffff" in name
      step 2: querying the file size
      step 3: size() return 0.

       

      • On Windows, when the file have ".lnk" extension, despite it is not a real Shortcut (symlink) file, size() always return 0 for the file, despite the real size of it.  

      reproduce:

      step 1: renaming file with ".lnk" extension
      step 2: querying the file size
      step 3: size() return 0.

      I know that this function will return the symlink's destination file size, but at here it's a valid file not a symlink, here i think it is a error

      Reproduce code, in Qt Creator

      #include <QCoreApplication>
      #include <QString>
      #include <QFileInfo>
      #include <QTextStream>
      #include <iostream>int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
          QTextStream outp(stdout);
          QTextStream inp(stdin);
          QString str;
          str= inp.readLine();
          outp<<"\n path: \n";
          outp.flush();
          QFileInfo file(str);
          outp<<file.absoluteFilePath();
          outp.flush();
          outp<<"\nsize: \n";
          outp<<file.size();
          outp.flush();
          return a.exec();
      } 

       

      (Because my company does not allow use of private account, so i have to create this account for bug reporting. Please cc itsthanhpham@gmail.com for further reply. Thank you.)

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            itsthanhpham-at-gmail astooon ciaeln
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes