29 lines
919 B
Diff
29 lines
919 B
Diff
From d4448c9379c72815b9ed5339dd3b07628eb944fd Mon Sep 17 00:00:00 2001
|
|
From: xzyfer <xzyfer@gmail.com>
|
|
Date: Thu, 21 Jun 2018 22:19:06 +1000
|
|
Subject: [PATCH] Fix invalid utf-8 error reporting
|
|
|
|
Fixes #2662
|
|
---
|
|
src/sass_context.cpp | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/src/sass_context.cpp b/src/sass_context.cpp
|
|
index 7a0a49ce1..642f435ee 100644
|
|
--- a/src/sass_context.cpp
|
|
+++ b/src/sass_context.cpp
|
|
@@ -81,7 +81,12 @@ namespace Sass {
|
|
while (line_end && *line_end && *line_end != '\n') {
|
|
if (*line_end == '\n') break;
|
|
if (*line_end == '\r') break;
|
|
+ const char* before = line_end;
|
|
utf8::unchecked::next(line_end);
|
|
+ if (!utf8::is_valid(line_beg, line_end)) {
|
|
+ line_end = before;
|
|
+ break;
|
|
+ }
|
|
}
|
|
if (line_end && *line_end != 0) ++ line_end;
|
|
size_t line_len = line_end - line_beg;
|
|
|