fix: fix some edge case errors

This commit is contained in:
PoiScript 2019-02-12 22:07:18 +08:00
parent 4d56633c43
commit c5a6d82aa8
4 changed files with 17 additions and 7 deletions

View file

@ -144,7 +144,7 @@ pub fn parse<'a>(src: &'a str) -> (Object<'a>, usize, Option<(Object<'a>, usize)
if let Some(off) = bs
.find(&bytes[pos + 1..])
.map(|i| i + pos + 1)
.filter(|&i| i < src.len() - 2)
.filter(|&i| i < src.len() - 3)
{
pos = off;
} else {