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

Buffer overflow when using large number with %f in printf-style functions

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • CRT
    • None

    Description

      When printing the value -9.2559592703107994e+061 using printf, format_float will try to generate 92559592703108026288888888888888888888888888888888888888888888.888888 as the output.
      This is too long to fit in the (32+17 char) buffer provided by streamout.

      VC2017's CRT prints -92559592703107994138415788239425558924699027280096573219930112.000000 as the output, which is the same size, so this is generally correct, our buffer just seems to be too small.

      The many 8's result from us casting the value to an unsigned __int64 to determine the digit to be printed, which just yields 9223372036854775808 aka (unsigned __int64)INT64_MIN repeatedly; however this is a secondary problem.

      Attachments

        Issue Links

          Activity

            People

              ThePhysicist Timo Kreuzer
              ThFabba ThFabba
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: