Skip to content

Commit fef6c6a

Browse files
glebmxzyfer
authored andcommitted
Fix heap-use-after-free in eval.cpp (#2859)
Fixes #2813
1 parent 2050492 commit fef6c6a

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

src/eval.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,21 +1588,6 @@ namespace Sass {
15881588
// a selector schema may or may not connect to parent?
15891589
bool chroot = s->connect_parent() == false;
15901590
Selector_List_Obj sl = p.parse_selector_list(chroot);
1591-
auto vec_str_rend = ctx.strings.rend();
1592-
auto vec_str_rbegin = ctx.strings.rbegin();
1593-
// remove the first item searching from the back
1594-
// we cannot assume our item is still the last one
1595-
// order is not important, so we can optimize this
1596-
auto it = std::find(vec_str_rbegin, vec_str_rend, temp_cstr);
1597-
// undefined behavior if not found!
1598-
if (it != vec_str_rend) {
1599-
// overwrite with last item
1600-
*it = ctx.strings.back();
1601-
// remove last one from vector
1602-
ctx.strings.pop_back();
1603-
// free temporary copy
1604-
free(temp_cstr);
1605-
}
16061591
flag_is_in_selector_schema.reset();
16071592
return operator()(sl);
16081593
}

0 commit comments

Comments
 (0)