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

Functions using QSettings crash with -fstack-protector on

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P1: Critical
    • None
    • 6.0.0
    • Core: Other
    • None
    • Windows

    Description

      1. Have a Qt 6.0.0 with GCC 8.1.0 on Windows (I haven't tried it on Linux but should work).
      2. Compile the following program:
      #include <QCoreApplication>
      #include <QSettings>
      #include <QTimer>
      
      int readSettings() {
          QSettings settings;
          return settings.value(QStringLiteral("Settings/Temp"), 1).toInt();
      }
      
      int main(int argc, char *argv[]) {
          QCoreApplication a(argc, argv);
          QCoreApplication::setApplicationName(QStringLiteral("AppName"));
          QCoreApplication::setOrganizationName(QStringLiteral("OrgName"));
          QCoreApplication::setOrganizationDomain(QStringLiteral("www.org.org"));
          QCoreApplication::setApplicationVersion(QStringLiteral("1.0"));
      
          volatile int i = readSettings();
      
          QTimer::singleShot(0, &a, &QCoreApplication::quit);
          return a.exec();
      } 
      QT -= gui
      CONFIG += c++11 console
      CONFIG -= app_bundle
      SOURCES += main.cpp
      QMAKE_CXXFLAGS += -fstack-protector
      win32: LIBS += -lssp 
      1. Observe that in readSettings the program crashes. If you remove stack protection by removing the last two lines in the .pro file, the error goes away.

      Attachments

        Issue Links

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

          Activity

            People

              thiago Thiago Macieira
              szotsaki Szőts Ákos
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes