Uploaded image for project: 'Qt Safe Renderer'
  1. Qt Safe Renderer
  2. QSR-2807

Refactor and improve the bitmap header field fetching function

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • QSR 3.0
    • Runtime
    • None

    Description

      Currently there is header field value fetching functions for both v3 and v4. They used to be more relevant when the parameter for header field offset was an enum (and even then it was not secure):

      quint32 QSafeBitmapReader::getHeaderFieldV3(const quint32 *const bitmap32BitPtr, const quint32 headerFieldOffsetV3)
      {
          const quint32 value = SafeRendererGenerics::qFromBigEndian<quint32>(&bitmap32BitPtr[headerFieldOffsetV3]);
          return value;
      }
      
      quint32 QSafeBitmapReader::getHeaderFieldV4(const quint32 *const bitmap32BitPtr, const quint32 headerFieldOffsetV4)
      {
          const quint32 value = SafeRendererGenerics::qFromBigEndian<quint32>(&bitmap32BitPtr[headerFieldOffsetV4]);
          return value;
      }
      

      These functions are identical, so they should be just one function.

      Additionally, the header field offset could be checked against the size of the bitmap here and not leave the check only for the calling function.

      Attachments

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

        Activity

          People

            qtsaferendererteam Qt Safe Renderer Team
            jussi_witick Jussi Witick
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes