From 0f6509381263a7f4fc9d1bf12b9854246d7ae945 Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Sat, 23 Oct 2021 17:43:20 -0500 Subject: [PATCH] Fix off-by-one deinit on DocumentStore --- src/DocumentStore.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DocumentStore.zig b/src/DocumentStore.zig index 03a8bc7..4954665 100644 --- a/src/DocumentStore.zig +++ b/src/DocumentStore.zig @@ -190,7 +190,8 @@ fn newDocument(self: *DocumentStore, uri: []const u8, text: [:0]u8) anyerror!*Ha .document = .{ .uri = uri, .text = text, - .mem = text, + // Extra +1 to include the null terminator + .mem = text.ptr[0 .. text.len + 1], }, .tree = tree, .document_scope = document_scope,