From c4525063b04596175d25177583ce1655791cbc0f Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 16 Mar 2017 10:16:39 +1100 Subject: Fix use-after-free in fold tags when top line folded then new top line inserted. In SparseVector, string inserted at start then NULL inserted at start. --- test/unit/testSparseVector.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/unit/testSparseVector.cxx') diff --git a/test/unit/testSparseVector.cxx b/test/unit/testSparseVector.cxx index 11960163e..e0db7d094 100644 --- a/test/unit/testSparseVector.cxx +++ b/test/unit/testSparseVector.cxx @@ -89,6 +89,18 @@ TEST_CASE("SparseVector") { st.Check(); } + SECTION("InsertStringAtStartThenInsertSpaceAtStart") { + REQUIRE(1 == st.Elements()); + st.InsertSpace(0, 5); + st.SetValueAt(0, "3"); + REQUIRE(1 == st.Elements()); + REQUIRE("3----" == Representation(st)); + st.InsertSpace(0, 1); + REQUIRE(2 == st.Elements()); + REQUIRE("-3----" == Representation(st)); + st.Check(); + } + SECTION("InsertAndDeleteAtEnd") { REQUIRE(1 == st.Elements()); st.InsertSpace(0, 5); -- cgit v1.2.3