diff --git a/flow/flat_buffers.cpp b/flow/flat_buffers.cpp index 1cb4b1099d..89fb058f98 100644 --- a/flow/flat_buffers.cpp +++ b/flow/flat_buffers.cpp @@ -488,6 +488,10 @@ TEST_CASE("/flow/FlatBuffers/Standalone") { // Meant to be run with valgrind or asan, to catch heap buffer overflows TEST_CASE("/flow/FlatBuffers/Void") { Standalone msg = ObjectWriter::toValue(Void(), Unversioned()); + // Manually verified to be a valid flatbuffers message. This is technically brittle since there are other valid + // encodings of this message, but our implementation is unlikely to change. + ASSERT(msg == LiteralStringRef("\x14\x00\x00\x00J\xad\x1e\x00\x00\x00\x04\x00\x04\x00\x06\x00\x08\x00\x04\x00\x06" + "\x00\x00\x00\x04\x00\x00\x00\x12\x00\x00\x00")); auto buffer = std::make_unique(msg.size()); // Make a heap allocation of precisely the right size, so // that asan or valgrind will catch any overflows memcpy(buffer.get(), msg.begin(), msg.size());