1
0
Fork 0
godot/core/input
HP van Braam 240f510fa7 Core ubsan fixes
This fixes UBSAN errors reported by running our testsuite, importing the
TPS demo, and running the TPS demo. I have tried, wherever possible, to
fix issues related to reported issues but not directly reported by UBSAN
because thse code paths just happened to not have been exercised in
these cases.

These fixes apply only to errors reported, and caused by, core/

The following things have been changed:

* Make sure there are no implicit sign changing casts in core.
* Explicitly type enums that are part of a public API such that users of
  the API cannot pass in wrongly-sized values leading to potential stack
  corruption.
* Ensure that memcpy is never called with invalid or null pointers as
  this is undefined behavior, and when the engine is built with
  optimizations turned on leads to memory corruption and hard to debug
  crashes.
* Replace enum values only used as static values with constexpr static
  const values instead. This has no runtime overhead. This makes it so
  that the size of the enums is explicit.
* Make sure that nan and inf is handled consistently in String.
* Implement a _to_int template to ensure that all of the paths use the
  same algorhithm, and correct the negative integer case.
* Changed the way the json serializer precision work, and added tests to
  verify the new behavior. The behavior doesn't quite match master in
  particulary for negative doubles as the original code tried to cast -inf
  to an int. This then led to negative doubles losing all but one of
  their decimal points when serializing. Behavior in GDScript remains
  unchanged.
2024-12-18 14:31:12 +01:00
..
SCsub SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 -05:00
default_controller_mappings.h
gamecontrollerdb.txt Sync controller mappings DB with SDL2 community repo [Nov 2024] 2024-11-15 21:56:25 -04:00
godotcontrollerdb.txt Fix gamepad triggers not working on web exports 2024-08-14 16:13:16 -03:00
input.compat.inc Implement `amplitude` to Input.vibrate_handheld 2024-05-02 19:09:42 +03:00
input.cpp Fix connecting a signal with a double click is too difficult 2024-12-14 16:18:34 +03:00
input.h Fix connecting a signal with a double click is too difficult 2024-12-14 16:18:34 +03:00
input_builders.py Style: Add `WARNING:` as new comment admonition 2024-09-25 09:44:42 -05:00
input_enums.h Core ubsan fixes 2024-12-18 14:31:12 +01:00
input_event.cpp Fix missing event metadata in _input() with Input.parse_input_event() 2024-12-06 22:08:16 +03:00
input_event.h Revert "Fix InputEvent device id clash" and add a compatibility function 2024-11-20 09:18:55 +01:00
input_map.compat.inc Changed the default deadzone value for new actions from 0.5 to 0.2 2024-10-01 16:47:44 +04:00
input_map.cpp Merge pull request #90723 from Calinou/textedit-autocompletion-always-replace-if-not-shift 2024-11-27 10:47:24 -06:00
input_map.h Revert "Fix InputEvent device id clash" and add a compatibility function 2024-11-20 09:18:55 +01:00
shortcut.cpp
shortcut.h