diff --git a/mesosphere/include/mesosphere/core/KAutoObject.hpp b/mesosphere/include/mesosphere/core/KAutoObject.hpp index 692cf4a65..1bd8160cd 100644 --- a/mesosphere/include/mesosphere/core/KAutoObject.hpp +++ b/mesosphere/include/mesosphere/core/KAutoObject.hpp @@ -95,7 +95,7 @@ class KAutoObject { SessionRequest, CodeMemory, // JIT - FinalClassesMax = CodeMemory, + Max = CodeMemory + 1, }; private: @@ -119,8 +119,10 @@ class KAutoObject { if constexpr (std::is_same_v) { return 0; } else if constexpr (!std::is_final_v) { + static_assert(T::typeId >= TypeId::SynchronizationObject && T::typeId < TypeId::FinalClassesMin, "Invalid type ID!"); return (1 << ((ushort)T::typeId - 1)) | GenerateClassToken(); } else { + static_assert(T::typeId >= TypeId::FinalClassesMin && T::typeId < TypeId::Max, "Invalid type ID!"); ushort off = (ushort)T::typeId - (ushort)TypeId::FinalClassesMin; return ((ushort)detail::A038444(off) << 9) | 0x100u | GenerateClassToken(); } diff --git a/mesosphere/include/mesosphere/core/make_object.hpp b/mesosphere/include/mesosphere/core/make_object.hpp index 205d35267..9785a2cfc 100644 --- a/mesosphere/include/mesosphere/core/make_object.hpp +++ b/mesosphere/include/mesosphere/core/make_object.hpp @@ -106,4 +106,4 @@ auto MakeObjectWithHandle(Args&& ...args) } } -} \ No newline at end of file +} diff --git a/mesosphere/include/mesosphere/processes/KProcess.hpp b/mesosphere/include/mesosphere/processes/KProcess.hpp index 109ab62a3..ba1787301 100644 --- a/mesosphere/include/mesosphere/processes/KProcess.hpp +++ b/mesosphere/include/mesosphere/processes/KProcess.hpp @@ -11,7 +11,7 @@ class KResourceLimit; namespace mesosphere { -class KProcess : public KAutoObject { +class KProcess final : public KAutoObject { public: MESOSPHERE_AUTO_OBJECT_TRAITS(AutoObject, Process);