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

Infinite recursion in QFSFileEnginePrivate::canonicalized if current directory is a symbolic link

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.8.0
    • 4.6.1
    • Core: I/O
    • None
    • 9c56dc1a2540a3bd6215d1165827f619c84a0b34

    Description

      Application crashes on QApplication instantiation due to out of memory in QFSFileEnginePrivate::canonicalized() if current directory is a symbolic link.
      The cause is bug in GetFullPathName() WinAPI function: if initial path is just drive letter with colon (for example 'd:') then it's expanded to current directory on this drive ('d:\current\directory', NOT 'd:\'). So if current directory is a symbolic link to another directory (say 'd:\real\directory') then QFSFileEnginePrivate::isSymlink('d:') returns true (which is not truth actually), since it uses GetFullPathName() to expand path first. QFileInfo::symLinkTarget() is affected too and returns 'd:\real\directory' for 'd:'. Note that 'd:\' (with backslash) is expanded by GetFullPathName() to 'd:\' without changes.
      As a result 'd:' is replaced by 'd:\real\directory' in endless loop until out of memory (see QFSFileEnginePrivate::canonicalized()).
      Proposed solution is workaround in nativeAbsoluteFilePath(). See attached patch.

      Attachments

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

        Activity

          People

            albisser Zeno Albisser
            oliatte Oleg Liatte
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes