Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-32022

Undefined behavior / potential security issue when reading JSON from dashboard server

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Not Evaluated Not Evaluated
    • Qt Creator 15.0.0
    • Qt Creator 15.0.0
    • Axivion
    • None
    • 5d092d04e (15.0)

      According to one of the Axivion-C++-Gurus, the code introduced when fixing QTCREATORBUG-32012 is potentially harmful:
       
      Andreas Loth: a colleague from out C++ analysis team told me this: another coll...
      sent on November 14, 2024 4:37 PM
       
      a colleague from our C++ analysis team told me this:

       casting from double to int has undefined behavior in C++ if the value is out-of-range!

      and I dimly remember a case where the compiler actually uses that UB to optimize out an integer array bound checks; resulting in an actual security issue

      another colleague mentioned this as alternative:

       QString::number(num,'f',num_decimal_places)

      f format never uses exponent notation

      I don't have enough C++-expertise to know how to do this properly, but the security issue mentioned would likely require a malicious dashboard server sending a double value in the JSON data that doesn't fit into a qint64.

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

            cstenger Christian Stenger
            daniel_hofmann Daniel Hofmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes