Update serdes.h (#4214)

This commit is contained in:
rainmakerv2 2026-04-04 13:38:51 +08:00 committed by GitHub
parent 26e2689b06
commit 450472b51f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,7 +42,8 @@ struct Archive {
}
void Advance(size_t size) {
ASSERT(offset + size <= container.size());
ASSERT_MSG(offset + size <= container.size(),
"Invalid or corrupted deserialization container/shader cache");
offset += size;
}
@ -104,7 +105,8 @@ struct Writer {
struct Reader {
template <typename T>
void Read(T* ptr, size_t size) {
ASSERT(ar.offset + size <= ar.container.size());
ASSERT_MSG(ar.offset + size <= ar.container.size(),
"Invalid or corrupted deserialization container/shader cache");
std::memcpy(reinterpret_cast<void*>(ptr), ar.CurrPtr(), size);
ar.Advance(size);
}