1
0
Fork 0
godot/core/object
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
callable_method_pointer.cpp Avoid sorting CallableCustomMethodPointers by their actual address values 2023-06-20 08:40:01 -04:00
callable_method_pointer.h Add missing CallableCustomMethodPointer for const methods 2024-09-23 11:46:10 -07:00
class_db.cpp Core ubsan fixes 2024-12-18 14:31:12 +01:00
class_db.h Fix Unable to use ResourceLoader in C# after threaded load in GDScript #92798 2024-09-11 19:03:55 -04:00
make_virtuals.py GDExtension: Mark virtual function as `is_required` in `extension_api.json` 2024-09-11 16:48:14 -05:00
message_queue.cpp WorkerThreadPool: Fix thread message queue not restored after overridden in a task 2024-06-13 10:31:08 +02:00
message_queue.h Style: Apply `clang-tidy` fixes (superficial) 2024-11-04 12:11:14 -06:00
method_bind.cpp Fix method hashes with default arguments 2023-09-21 12:39:04 -05:00
method_bind.h Set clang-format `RemoveSemicolon` rule to `true` 2024-10-25 13:49:43 -04:00
object.cpp [Core] Improve error messages with `vformat` 2024-10-30 15:55:51 +01:00
object.h Revert "Avoid duplicating signals from scene instances into packed scenes" 2024-12-10 10:42:58 +01:00
object_id.h Core ubsan fixes 2024-12-18 14:31:12 +01:00
ref_counted.cpp One Copyright Update to rule them all 2023-01-05 13:25:55 +01:00
ref_counted.h Get rid of easily removable uses of const_cast 2024-12-01 17:50:13 -08:00
script_instance.cpp Add methods to get argument count of methods 2024-03-10 11:02:43 +01:00
script_instance.h Add methods to get argument count of methods 2024-03-10 11:02:43 +01:00
script_language.cpp Fix various typos and code style issues 2024-11-28 17:40:42 +01:00
script_language.h Set clang-format `RemoveSemicolon` rule to `true` 2024-10-25 13:49:43 -04:00
script_language_extension.cpp Fix virtual binding for `ScriptLanguageExtension::_reload_scripts` 2024-08-17 21:09:32 -07:00
script_language_extension.h Merge pull request #93311 from dsnopek/gdextension-required-virtuals 2024-09-27 13:53:16 +02:00
undo_redo.cpp [Core] Improve error messages with `vformat` 2024-10-30 15:55:51 +01:00
undo_redo.h Discard additional redo on commiting actions 2024-09-24 15:47:55 +02:00
worker_thread_pool.cpp WorkerThreadPool: Add safety point between languages finished and pool termination 2024-09-16 18:20:10 +02:00
worker_thread_pool.h Force `get_thread_count()` to `1` if single threaded 2024-11-18 22:27:17 -05:00