Skip to content

Commit

Permalink
Add assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzhu2118 committed Jan 8, 2021
1 parent 6dc5d6b commit a406547
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ext/liquid_c/template.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ static VALUE template_load(VALUE self, VALUE serialized_data, VALUE options)
rb_raise(cLiquidCDeserializationError, "Incompatible serialization versions, expected %u but got %u\n", DOCUMENT_BODY_CURRENT_VERSION, header->version);
}

assert(RSTRING_LEN(serialized_data) >= (long)sizeof(*header));
assert(RSTRING_LEN(serialized_data) >= header->buffer_offset + header->buffer_offset);
const char *body_data = data + header->buffer_offset;

Expand Down

0 comments on commit a406547

Please sign in to comment.