diff --git a/FlyleafLib/Utils.cs b/FlyleafLib/Utils.cs index caac59d9..86a9ce68 100644 --- a/FlyleafLib/Utils.cs +++ b/FlyleafLib/Utils.cs @@ -369,7 +369,7 @@ public static bool IsUtf8(byte[] buffer, int length) { int position = 0; int bytes = 0; - while (position < length) + while (position < length - 4) { if (!IsValid(buffer, position, length, ref bytes)) {