From 1e23b4ddf4d2dfbf9fa860e8f54fa18fac6b8556 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Thu, 18 Jul 2019 01:42:57 -0400 Subject: [PATCH] fix: Error on non-int str-insert index See https://github.com/sass/sass-spec/pull/1439 Closes #2921 --- src/fn_strings.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fn_strings.cpp b/src/fn_strings.cpp index b09fce9a6..d6adecbf1 100644 --- a/src/fn_strings.cpp +++ b/src/fn_strings.cpp @@ -99,6 +99,9 @@ namespace Sass { String_Constant* i = ARG("$insert", String_Constant); std::string ins = i->value(); double index = ARGVAL("$index"); + if (index != (int)index) { + error("$index: " + std::to_string(index) + " is not an int", pstate, traces); + } size_t len = UTF_8::code_point_count(str, 0, str.size()); if (index > 0 && index <= len) {