From 2c0e02277ce98003de144018693a89a3749df52b Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 24 Mar 2024 02:22:37 -0500 Subject: [PATCH] [ox/std] Add assert to AnyPtr::Wrap::copyTo to ensure sufficiently large buff --- deps/ox/src/ox/std/anyptr.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deps/ox/src/ox/std/anyptr.hpp b/deps/ox/src/ox/std/anyptr.hpp index c6611318..ac11e484 100644 --- a/deps/ox/src/ox/std/anyptr.hpp +++ b/deps/ox/src/ox/std/anyptr.hpp @@ -1,7 +1,9 @@ #pragma once +#include "assert.hpp" #include "array.hpp" +#include "def.hpp" #include "span.hpp" namespace ox { @@ -20,6 +22,7 @@ class AnyPtr { constexpr Wrap(T *pData) noexcept: data(pData) { } constexpr WrapBase *copyTo(ox::Span s) noexcept override { + oxAssert(s.size() >= sizeof(Wrap), "too small buffer"); if (std::is_constant_evaluated()) { return new Wrap(data); } else {