Skip to content

Commit 44e7a9e

Browse files
committed
fix: non-integers passed to str-slice
See sass/sass-spec#1443 Closes #2922
1 parent ac338df commit 44e7a9e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/fn_strings.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ namespace Sass {
163163
String_Constant* s = ARG("$string", String_Constant);
164164
double start_at = ARGVAL("$start-at");
165165
double end_at = ARGVAL("$end-at");
166+
167+
if (start_at != (int)start_at) {
168+
error("$start-at: " + std::to_string(start_at) + " is not an int", pstate, traces);
169+
}
170+
166171
String_Quoted* ss = Cast<String_Quoted>(s);
167172

168173
std::string str(s->value());
@@ -173,6 +178,10 @@ namespace Sass {
173178
end_at = -1;
174179
}
175180

181+
if (end_at != (int)end_at) {
182+
error("$end-at: " + std::to_string(end_at) + " is not an int", pstate, traces);
183+
}
184+
176185
if (end_at == 0 || (end_at + size) < 0) {
177186
if (ss && ss->quote_mark()) newstr = quote("");
178187
return SASS_MEMORY_NEW(String_Quoted, pstate, newstr);

0 commit comments

Comments
 (0)