[Commits] [wesnoth/wesnoth] bdd173: Fix bug #25538: Monte Carlo damage prediction reli...

GitHub noreply at github.com
Sun Feb 26 16:14:37 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: bdd173f22270ea0d40fbd4469a5146b1f46d432d
      https://github.com/wesnoth/wesnoth/commit/bdd173f22270ea0d40fbd4469a5146b1f46d432d
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2017-02-26 (Sun, 26 Feb 2017)

  Changed paths:
    M src/attack_prediction.cpp

  Log Message:
  -----------
  Fix bug #25538: Monte Carlo damage prediction relies on UB

IEEE 754 specifies that dividing a positive number with zero yields
positive infinity, but the C++ language doesn't guarantee IEEE 754
semantics. As a result, UBSan complains about floating-point division by
zero. Wesnoth requires IEEE 754 anyway, but it's still good to get rid of
the UBSan warning.

The code now avoids the division if the divisor is zero.





More information about the Commits mailing list