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

QResource::registerResource does not perform check for resource file validity.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.4.0
    • 4.7.3
    • Build tools: rcc
    • None
    • Windows Vista/7/XP and Mac Os X Lion
    • f14470fa0062a71b9eeac7f6904fbc5d92c133d2

      QResource::registerResource performs only signature check for given resource file while registering (see QResource::registerSelf(), line "if(b[offset+0] != 'q' || b[offset+1] != 'r' ||" ), so any corrupted resource file with good signature will be successfully registered. There should be a method allowing to check resource file for validity to avoid crashes.

      Demo is attached. This application loads correct qrc file, then creates copy, truncates it and loads again.

      How to reproduce:
      1) upack zip
      2) run makerc.bat
      3) compile application
      4) run the app and the following line will cause crash: ui.label_2->setPixmap(QPixmap(":/bad/dummy/2.png"));

        1. qrc__bug__demo.zip
          303 kB
          Qt Support
        For Gerrit Dashboard: QTBUG-21254
        # Subject Branch Project Status CR V

            hjk hjk
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes