Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
Examples of errors detected by the...

Examples of errors detected by the V1116 diagnostic

V1116. Creating an exception object without an explanatory message may result in insufficient logging.


Battle for Wesnoth

V1116 [CWE-778] Creating an exception object without an explanatory message may result in insufficient logging. charconv.hpp 146


inline double stod(std::string_view str) {
  trim_for_from_chars(str);
  double res;
  auto [ptr, ec] = utils::charconv::from_chars(str.data(),
                                   str.data() + str.size(), res);

  if(ec == std::errc::invalid_argument) {
    throw std::invalid_argument("");                  // <=
  } else  if(ec == std::errc::result_out_of_range) {
    throw std::out_of_range("");                      // <=
  }
  return res;
}

Similar errors can be found in some other places:

  • V1116 [CWE-778] Creating an exception object without an explanatory message may result in insufficient logging. charconv.hpp 148
  • V1116 [CWE-778] Creating an exception object without an explanatory message may result in insufficient logging. charconv.hpp 159
  • V1116 [CWE-778] Creating an exception object without an explanatory message may result in insufficient logging. charconv.hpp 161