From 912a1ddf68e1d1118cdbba2b9a6fcbf99e5b35b8 Mon Sep 17 00:00:00 2001 From: MistEO Date: Tue, 26 Dec 2023 16:15:37 +0800 Subject: [PATCH] sep --- include/json5.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/json5.hpp b/include/json5.hpp index feb9da7..5e907c2 100644 --- a/include/json5.hpp +++ b/include/json5.hpp @@ -742,7 +742,10 @@ inline typename parser5::u8char parser5::peek(const StringIter head <<= 1; ++len; ch <<= 8; - ch += (uint8_t)(*(begin + len - 1)); + auto sep = begin + len - 1; + if (sep < end) { + ch += (uint8_t)(*sep); + } } if (plen) { *plen = len;