1
0
Fork 0
godot/core
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
..
config Core ubsan fixes 2024-12-18 14:31:12 +01:00
crypto Core ubsan fixes 2024-12-18 14:31:12 +01:00
debugger Add contains_char() for single-character 'contains' calls. 2024-12-06 20:23:35 +01:00
error Fix race conditions in breadcrumbs 2024-10-22 22:08:46 -03:00
extension Add contains_char() for single-character 'contains' calls. 2024-12-06 20:23:35 +01:00
input Core ubsan fixes 2024-12-18 14:31:12 +01:00
io Core ubsan fixes 2024-12-18 14:31:12 +01:00
math Core ubsan fixes 2024-12-18 14:31:12 +01:00
object Core ubsan fixes 2024-12-18 14:31:12 +01:00
os Core ubsan fixes 2024-12-18 14:31:12 +01:00
string Core ubsan fixes 2024-12-18 14:31:12 +01:00
templates Core ubsan fixes 2024-12-18 14:31:12 +01:00
variant Core ubsan fixes 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
core_bind.compat.inc [OS] Add functions to determine standard I/O device type. 2024-11-06 13:33:38 +02:00
core_bind.cpp Add file and dir temporary utilities 2024-12-02 12:08:14 -05:00
core_bind.h Add file and dir temporary utilities 2024-12-02 12:08:14 -05:00
core_builders.py Update pre-commit hooks configuration to use `ruff` instead of `black` 2024-05-21 18:02:29 -05:00
core_constants.cpp Add hint for oneshot & warning when it will be updated continuously 2024-11-11 01:12:45 +09:00
core_constants.h Add const lvalue ref to container parameters 2024-01-05 14:49:57 -03:00
core_globals.cpp
core_globals.h
core_string_names.h Move singleton StringName definitions to header 2024-12-06 13:43:31 +01:00
doc_data.cpp Implement typed dictionaries 2024-09-04 10:27:26 -05:00
doc_data.h Docs: Add missing deprecated/experimental tag support for theme items 2024-09-04 17:49:05 +03:00
register_core_types.cpp Register Engine, OS, ProjectSettings, and Time early. 2024-11-21 18:09:03 -05:00
register_core_types.h Register Engine, OS, ProjectSettings, and Time early. 2024-11-21 18:09:03 -05:00
typedefs.h Optimize `SWAP` macro by using move semantics. 2024-12-13 16:19:52 +01:00
version.h Display the build date in the editor and when starting the engine 2024-02-27 20:39:17 +01:00