Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-9946

intsafe addition functions do not fail when they should

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Fix Version/s: 0.4.0
    • Component/s: CRT
    • Labels:
      None

      Description

      DEFINE_SAFE_ADD checks if "Augend + Addend >= Augend" to detect overflow. However arithmetic operations involve integer promotions, so e.g. (UINT8)255 + (UINT8)1 is 256 instead of 0. The check needs a cast back to the source type

        Attachments

          Activity

            People

            • Assignee:
              ThFabba ThFabba
              Reporter:
              ThFabba ThFabba
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: