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

intsafe addition functions do not fail when they should

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 0.4.0
    • CRT
    • 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

            ThFabba ThFabba
            ThFabba ThFabba
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: