From 72d96638a470bb9bc2d951a87301efba454f9314 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Mon, 1 Jul 2024 23:39:12 +0200 Subject: [PATCH] fix(Parser): prevent index out of bounds error in skipUntilST --- src/Parser.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Parser.zig b/src/Parser.zig index aea8f66..767985f 100644 --- a/src/Parser.zig +++ b/src/Parser.zig @@ -212,6 +212,12 @@ inline fn skipUntilST(input: []const u8) Result { .event = null, .n = 0, }; + if (input.len < end + 1 + 1) { + return .{ + .event = null, + .n = 0, + }; + } const sequence = input[0 .. end + 1 + 1]; return .{ .event = null,