[all-commits] [llvm/llvm-project] 3d9532: [libc] Fix strtod exponent overflow bug

michaelrj-google via All-commits all-commits at lists.llvm.org
Wed Apr 12 15:27:17 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3d953234fede3cb0532c876fd4ba9ea4d89fbd7c
      https://github.com/llvm/llvm-project/commit/3d953234fede3cb0532c876fd4ba9ea4d89fbd7c
  Author: Michael Jones <michaelrj at google.com>
  Date:   2023-04-12 (Wed, 12 Apr 2023)

  Changed paths:
    M libc/src/__support/str_to_float.h
    M libc/test/src/stdlib/strtod_test.cpp

  Log Message:
  -----------
  [libc] Fix strtod exponent overflow bug

String to float has a condition to prevent overflowing the exponent with
the E notation. To do this it checks if adding that exponent to the
exponent found by parsing the number is greater than the maximum
exponent for the given size of float. The if statements had a gap on
exactly the maximum exponent value that caused it to be treated as the
minimum exponent value. This patch fixes those conditions.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D148152




More information about the All-commits mailing list