[keel] Add ensureValid call to readAsset
This commit is contained in:
parent
f772e48b36
commit
6522cf8a43
@ -7,6 +7,8 @@
|
|||||||
#include <ox/claw/claw.hpp>
|
#include <ox/claw/claw.hpp>
|
||||||
#include <ox/fs/fs.hpp>
|
#include <ox/fs/fs.hpp>
|
||||||
|
|
||||||
|
#include "validation.hpp"
|
||||||
|
|
||||||
namespace keel {
|
namespace keel {
|
||||||
|
|
||||||
constexpr auto K1HdrSz = 40;
|
constexpr auto K1HdrSz = 40;
|
||||||
@ -26,7 +28,9 @@ ox::Result<T> readAsset(ox::BufferView buff) noexcept {
|
|||||||
if (!err) {
|
if (!err) {
|
||||||
offset = K1HdrSz; // the size of K1 headers
|
offset = K1HdrSz; // the size of K1 headers
|
||||||
}
|
}
|
||||||
return ox::readClaw<T>(buff + offset);
|
auto out = ox::readClaw<T>(buff + offset);
|
||||||
|
oxReturnError(out);
|
||||||
|
return ensureValid(out.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Result<ox::ModelObject> readAsset(ox::TypeStore &ts, ox::BufferView buff) noexcept;
|
ox::Result<ox::ModelObject> readAsset(ox::TypeStore &ts, ox::BufferView buff) noexcept;
|
||||||
|
Loading…
Reference in New Issue
Block a user