1
0
Fork 0
godot/core/templates
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
a_hash_map.cpp Implement array based hash map 2024-10-24 21:34:12 +03:00
a_hash_map.h Fix `capture_cache.animation` was not cached 2024-10-31 19:26:02 +02:00
bin_sorted_array.h Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
command_queue_mt.cpp WorkerThreadPool (plus friends): Overhaul unlock allowance zones 2024-08-21 12:22:52 +02:00
command_queue_mt.h Core ubsan fixes 2024-12-18 14:31:12 +01:00
cowdata.h Add move constructor and move assignment to CowData, String, Char16String, CharString and Vector. 2024-12-11 15:52:15 +01:00
hash_map.cpp Add a sort method to Dictionary and HashMap 2024-10-02 14:26:33 -07:00
hash_map.h Add a sort method to Dictionary and HashMap 2024-10-02 14:26:33 -07:00
hash_set.h Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
hashfuncs.h Core ubsan fixes 2024-12-18 14:31:12 +01:00
list.h Avoid const_cast in List::erase by requiring mutable elements 2024-11-08 00:10:08 -08:00
local_vector.h Core ubsan fixes 2024-12-18 14:31:12 +01:00
lru.h Merge pull request #98652 from stuartcarnie/2d_texture_state_fixes 2024-10-29 19:25:54 -05:00
oa_hash_map.h Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
paged_allocator.h Improve Template Class Conditionals (Code Style) 2024-08-25 18:10:51 +01:00
paged_array.h Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
pair.h Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
pass_func.h One Copyright Update to rule them all 2023-01-05 13:25:55 +01:00
pooled_list.h Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
rb_map.h Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
rb_set.h Set clang-format `RemoveSemicolon` rule to `true` 2024-10-25 13:49:43 -04:00
rid.h One Copyright Update to rule them all 2023-01-05 13:25:55 +01:00
rid_owner.cpp One Copyright Update to rule them all 2023-01-05 13:25:55 +01:00
rid_owner.h Make RID_Owner lock-free for fetching. 2024-09-25 15:05:24 -03:00
ring_buffer.h Fix GCC 14 -Wtemplate-id-cdtor warnings 2024-04-26 11:41:09 +02:00
safe_list.h Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
safe_refcount.h Fix GCC 14 -Wtemplate-id-cdtor warnings 2024-04-26 11:41:09 +02:00
search_array.h Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
self_list.h Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
simple_type.h Redefine GetSimpleTypeT<> in terms of <type_traits> 2024-04-24 11:43:13 +02:00
sort_array.h Improve Template Class Conditionals (Code Style) 2024-08-25 18:10:51 +01:00
vector.h Core ubsan fixes 2024-12-18 14:31:12 +01:00
vmap.h Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
vset.h Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00