Skip to content

Commit

Permalink
svf: fix junk data included in the generated schema
Browse files Browse the repository at this point in the history
  • Loading branch information
tempname11 committed Nov 15, 2023
1 parent 7f3e875 commit cebe668
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 129 deletions.
78 changes: 18 additions & 60 deletions svf_runtime/src/svf_meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ typedef struct SVFRT_Sequence {

#define SVF_Meta_min_read_scratch_memory_size 450
#define SVF_Meta_compatibility_work_base 456
#define SVF_Meta_schema_binary_size 1355
#define SVF_Meta_schema_binary_size 1019
#define SVF_Meta_schema_id 0x6DADEAAEE49D6D18ull
#define SVF_Meta_schema_content_hash 0x6127241CA5448758ull
#define SVF_Meta_schema_content_hash 0x5AB083CE4C8A2D3Bull
extern uint8_t const SVF_Meta_schema_binary_array[];
extern uint32_t const SVF_Meta_schema_struct_strides[];
#define SVF_Meta_schema_struct_count 12
Expand Down Expand Up @@ -205,83 +205,41 @@ uint32_t const SVF_Meta_schema_struct_strides[] = {
};

uint8_t const SVF_Meta_schema_binary_array[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xEF, 0xA5, 0xA1, 0xB2, 0x79, 0x4A, 0xB9, 0x85,
0x18, 0x00, 0x00, 0x00, 0x97, 0xFD, 0xFF, 0xFF,
0x18, 0x00, 0x00, 0x00, 0xE7, 0xFE, 0xFF, 0xFF,
0x03, 0x00, 0x00, 0x00, 0x2F, 0x98, 0x54, 0xC8,
0x3E, 0xFF, 0x40, 0x22, 0x14, 0x00, 0x00, 0x00,
0x5E, 0xFD, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
0xAE, 0xFE, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
0x81, 0x65, 0x8A, 0xA2, 0x32, 0x0B, 0x3C, 0x71,
0x14, 0x00, 0x00, 0x00, 0x25, 0xFD, 0xFF, 0xFF,
0x14, 0x00, 0x00, 0x00, 0x75, 0xFE, 0xFF, 0xFF,
0x03, 0x00, 0x00, 0x00, 0x05, 0x46, 0x32, 0xCB,
0xC1, 0xFB, 0xEB, 0xE1, 0x04, 0x00, 0x00, 0x00,
0xEC, 0xFC, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
0x3C, 0xFE, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
0x1F, 0xD8, 0x2D, 0x46, 0x39, 0xB2, 0xAD, 0x20,
0x04, 0x00, 0x00, 0x00, 0xD9, 0xFC, 0xFF, 0xFF,
0x04, 0x00, 0x00, 0x00, 0x29, 0xFE, 0xFF, 0xFF,
0x01, 0x00, 0x00, 0x00, 0x80, 0x98, 0xC0, 0xAF,
0x70, 0x8B, 0xB5, 0xAE, 0x08, 0x00, 0x00, 0x00,
0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 0xD2, 0x4B, 0x8D, 0x69,
0x04, 0x00, 0x00, 0x00, 0x8D, 0xFC, 0xFF, 0xFF,
0x04, 0x00, 0x00, 0x00, 0xDD, 0xFD, 0xFF, 0xFF,
0x0C, 0x00, 0x00, 0x00, 0x0D, 0x10, 0x6B, 0x7D,
0xFB, 0x3A, 0x22, 0xD2, 0x05, 0x00, 0x00, 0x00,
0x94, 0xFB, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
0xE4, 0xFC, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
0xAB, 0x87, 0x7B, 0x2F, 0x57, 0xC0, 0x4B, 0x65,
0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0x09, 0xA2, 0x22, 0x4C, 0x0B,
Expand Down Expand Up @@ -372,8 +330,8 @@ uint8_t const SVF_Meta_schema_binary_array[] = {
0x7B, 0x69, 0xBC, 0x4F, 0xBD, 0x4D, 0x15, 0x10,
0x12, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x6D, 0x9D, 0xE4, 0xAE,
0xEA, 0xAD, 0x6D, 0xAF, 0xFE, 0xFF, 0xFF, 0x0C,
0x00, 0x00, 0x00, 0xBF, 0xFD, 0xFF, 0xFF, 0x02,
0xEA, 0xAD, 0x6D, 0xFF, 0xFF, 0xFF, 0xFF, 0x0C,
0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0x02,
0x00, 0x00, 0x00
};
#endif // SVF_Meta_BINARY_INCLUDED_H
Expand Down
78 changes: 18 additions & 60 deletions svf_runtime/src/svf_meta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace Meta {
extern uint32_t const struct_strides[];

namespace binary {
size_t const size = 1355;
size_t const size = 1019;
extern uint8_t const array[];
} // namespace binary

Expand Down Expand Up @@ -200,7 +200,7 @@ struct _SchemaDescription {
static constexpr uint32_t min_read_scratch_memory_size = 450;
static constexpr uint32_t compatibility_work_base = 456;
static constexpr uint64_t schema_id = 0x6DADEAAEE49D6D18ull;
static constexpr uint64_t content_hash = 0x6127241CA5448758ull;
static constexpr uint64_t content_hash = 0x5AB083CE4C8A2D3Bull;
};

// C++ trickery: _SchemaDescription::PerType.
Expand Down Expand Up @@ -366,83 +366,41 @@ uint32_t const struct_strides[] = {
namespace binary {

uint8_t const array[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xEF, 0xA5, 0xA1, 0xB2, 0x79, 0x4A, 0xB9, 0x85,
0x18, 0x00, 0x00, 0x00, 0x97, 0xFD, 0xFF, 0xFF,
0x18, 0x00, 0x00, 0x00, 0xE7, 0xFE, 0xFF, 0xFF,
0x03, 0x00, 0x00, 0x00, 0x2F, 0x98, 0x54, 0xC8,
0x3E, 0xFF, 0x40, 0x22, 0x14, 0x00, 0x00, 0x00,
0x5E, 0xFD, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
0xAE, 0xFE, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
0x81, 0x65, 0x8A, 0xA2, 0x32, 0x0B, 0x3C, 0x71,
0x14, 0x00, 0x00, 0x00, 0x25, 0xFD, 0xFF, 0xFF,
0x14, 0x00, 0x00, 0x00, 0x75, 0xFE, 0xFF, 0xFF,
0x03, 0x00, 0x00, 0x00, 0x05, 0x46, 0x32, 0xCB,
0xC1, 0xFB, 0xEB, 0xE1, 0x04, 0x00, 0x00, 0x00,
0xEC, 0xFC, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
0x3C, 0xFE, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
0x1F, 0xD8, 0x2D, 0x46, 0x39, 0xB2, 0xAD, 0x20,
0x04, 0x00, 0x00, 0x00, 0xD9, 0xFC, 0xFF, 0xFF,
0x04, 0x00, 0x00, 0x00, 0x29, 0xFE, 0xFF, 0xFF,
0x01, 0x00, 0x00, 0x00, 0x80, 0x98, 0xC0, 0xAF,
0x70, 0x8B, 0xB5, 0xAE, 0x08, 0x00, 0x00, 0x00,
0xC6, 0xFC, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
0x16, 0xFE, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
0x98, 0x7A, 0x0F, 0xE8, 0xFB, 0x2A, 0x6C, 0xDF,
0x10, 0x00, 0x00, 0x00, 0xB3, 0xFC, 0xFF, 0xFF,
0x10, 0x00, 0x00, 0x00, 0x03, 0xFE, 0xFF, 0xFF,
0x02, 0x00, 0x00, 0x00, 0x7D, 0x93, 0xA2, 0x75,
0xDB, 0x45, 0x0D, 0xAD, 0x05, 0x00, 0x00, 0x00,
0xCD, 0xFB, 0xFF, 0xFF, 0x01, 0x00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x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0x09, 0xA2, 0x22, 0x4C, 0x0B,
Expand Down Expand Up @@ -533,8 +491,8 @@ uint8_t const array[] = {
0x7B, 0x69, 0xBC, 0x4F, 0xBD, 0x4D, 0x15, 0x10,
0x12, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x6D, 0x9D, 0xE4, 0xAE,
0xEA, 0xAD, 0x6D, 0xAF, 0xFE, 0xFF, 0xFF, 0x0C,
0x00, 0x00, 0x00, 0xBF, 0xFD, 0xFF, 0xFF, 0x02,
0xEA, 0xAD, 0x6D, 0xFF, 0xFF, 0xFF, 0xFF, 0x0C,
0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0x02,
0x00, 0x00, 0x00
};

Expand Down
20 changes: 11 additions & 9 deletions svf_tools/src/core/generation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@ GenerationResult as_bytes(
// TODO: check struct/choice ID for collisions. Currently, multiple
// definitions with the same ID are accepted, which is not great.

// This arena is used to write the message.
auto start_arena = vm::realign(arena);
// This arena is used to accumulate name mappings.
auto start_arena2_map = vm::realign(arena2);

Expand Down Expand Up @@ -386,6 +384,10 @@ GenerationResult as_bytes(
}

// Third pass: fill in our output types.

// This arena is used to write the message.
auto start_arena_data = vm::realign(arena);

auto out_structs = vm::many<Meta::StructDefinition>(arena, num_structs);
auto out_choices = vm::many<Meta::ChoiceDefinition>(arena, num_choices);

Expand Down Expand Up @@ -461,7 +463,7 @@ GenerationResult as_bytes(
.typeId = in_struct->name_hash,
.size = size_sum,
.fields = {
.data_offset_complement = ~offset_between<U32>(start_arena, out_fields.pointer),
.data_offset_complement = ~offset_between<U32>(start_arena_data, out_fields.pointer),
.count = safe_int_cast<U32>(out_fields.count),
},
};
Expand Down Expand Up @@ -535,7 +537,7 @@ GenerationResult as_bytes(
.typeId = in_choice->name_hash,
.payloadSize = size_max,
.options = {
.data_offset_complement = ~offset_between<U32>(start_arena, out_options.pointer),
.data_offset_complement = ~offset_between<U32>(start_arena_data, out_options.pointer),
.count = safe_int_cast<U32>(out_options.count),
},
};
Expand All @@ -553,16 +555,16 @@ GenerationResult as_bytes(
*out_definition = Meta::SchemaDefinition {
.schemaId = in_root->schema_name_hash,
.structs = {
.data_offset_complement = ~offset_between<U32>(start_arena, out_structs.pointer),
.data_offset_complement = ~offset_between<U32>(start_arena_data, out_structs.pointer),
.count = safe_int_cast<U32>(out_structs.count),
},
.choices = {
.data_offset_complement = ~offset_between<U32>(start_arena, out_choices.pointer),
.data_offset_complement = ~offset_between<U32>(start_arena_data, out_choices.pointer),
.count = safe_int_cast<U32>(out_choices.count),
},
};

auto end_arena = arena->reserved_range.pointer + arena->waterline;
auto end_arena_data = arena->reserved_range.pointer + arena->waterline;
auto end_arena2_map = arena2->reserved_range.pointer + arena2->waterline;

auto names = Range<NameMappingToWrite> {
Expand Down Expand Up @@ -625,8 +627,8 @@ GenerationResult as_bytes(

return GenerationResult {
.schema = {
.pointer = (Byte *) start_arena,
.count = offset_between<U64>(start_arena, end_arena),
.pointer = (Byte *) start_arena_data,
.count = offset_between<U64>(start_arena_data, end_arena_data),
},
.appendix = {
.pointer = (Byte *) start_arena2_appendix,
Expand Down

0 comments on commit cebe668

Please sign in to comment.