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

QSharedMemory::size() can be larger than the size passed to QSharedMemory::create

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Done
    • Affects Version/s: 5.9.1
    • Fix Version/s: 5.9.2
    • Component/s: Core: Other, Documentation
    • Labels:
      None
    • Environment:
      Windows 7 x64
    • Commits:
      b7bcd03d194495f3e7230e0cd757b04641c633d9

      Description

      At least on Windows, it appears that the resulting shared memory segment created by `QSharedMemory::create` can be larger than the requested size due to alignment, and `QSharedMemory::size` returns the actual size of the shared memory segment instead of the requested size.

      However, this is not stated in the documentation at all.

      Users could have the false assumption that `QSharedMemory::size` returns the requested size and use it with functions like `memcpy` with another buffer, leading to buffer overflow.

        Attachments

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

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            alvinhochun Alvin Wong
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes