Guard against serialization buffer overflows from wasm languages

This commit is contained in:
Max Brunsfeld 2024-04-25 13:51:05 -07:00
parent d7a23cf017
commit e9fd4ccf0c

View file

@ -1642,6 +1642,10 @@ uint32_t ts_wasm_store_call_scanner_serialize(
if (self->has_error) return 0;
uint32_t length = args[0].i32;
if (length > TREE_SITTER_SERIALIZATION_BUFFER_SIZE) {
self->has_error = true;
return 0;
}
if (length > 0) {
memcpy(