[ox/std] Add assert to AnyPtr::Wrap::copyTo to ensure sufficiently large buff
All checks were successful
Build / build (push) Successful in 2m39s
All checks were successful
Build / build (push) Successful in 2m39s
This commit is contained in:
parent
e3c74637db
commit
2c0e02277c
3
deps/ox/src/ox/std/anyptr.hpp
vendored
3
deps/ox/src/ox/std/anyptr.hpp
vendored
@ -1,7 +1,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "assert.hpp"
|
||||||
#include "array.hpp"
|
#include "array.hpp"
|
||||||
|
#include "def.hpp"
|
||||||
#include "span.hpp"
|
#include "span.hpp"
|
||||||
|
|
||||||
namespace ox {
|
namespace ox {
|
||||||
@ -20,6 +22,7 @@ class AnyPtr {
|
|||||||
constexpr Wrap(T *pData) noexcept: data(pData) {
|
constexpr Wrap(T *pData) noexcept: data(pData) {
|
||||||
}
|
}
|
||||||
constexpr WrapBase *copyTo(ox::Span<char> s) noexcept override {
|
constexpr WrapBase *copyTo(ox::Span<char> s) noexcept override {
|
||||||
|
oxAssert(s.size() >= sizeof(Wrap), "too small buffer");
|
||||||
if (std::is_constant_evaluated()) {
|
if (std::is_constant_evaluated()) {
|
||||||
return new Wrap(data);
|
return new Wrap(data);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user