Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
fix: non-integers passed to str-slice
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni committed Jul 18, 2019
1 parent ac338df commit 44e7a9e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/fn_strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ namespace Sass {
String_Constant* s = ARG("$string", String_Constant);
double start_at = ARGVAL("$start-at");
double end_at = ARGVAL("$end-at");

if (start_at != (int)start_at) {
error("$start-at: " + std::to_string(start_at) + " is not an int", pstate, traces);
}

String_Quoted* ss = Cast<String_Quoted>(s);

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

if (end_at != (int)end_at) {
error("$end-at: " + std::to_string(end_at) + " is not an int", pstate, traces);
}

if (end_at == 0 || (end_at + size) < 0) {
if (ss && ss->quote_mark()) newstr = quote("");
return SASS_MEMORY_NEW(String_Quoted, pstate, newstr);
Expand Down

0 comments on commit 44e7a9e

Please sign in to comment.