mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Fix crash in rdcarray comparison
This commit is contained in:
@@ -182,7 +182,7 @@ public:
|
||||
c = o.usedCount;
|
||||
|
||||
// compare the range
|
||||
int comp = ItemHelper<T>::compRange(elems, o.elems, usedCount);
|
||||
int comp = ItemHelper<T>::compRange(elems, o.elems, c);
|
||||
// if it's not equal, we can return either true or false now
|
||||
if(comp != 0)
|
||||
return (comp < 0);
|
||||
|
||||
@@ -250,6 +250,13 @@ TEST_CASE("Test array type", "[basictypes]")
|
||||
CHECK(test2 < test);
|
||||
CHECK_FALSE(test < test2);
|
||||
CHECK_FALSE(test == test2);
|
||||
|
||||
// ensure in the case of comparing different sized arrays we don't read off the end of one
|
||||
rdcarray<int> emptyTest;
|
||||
|
||||
CHECK(emptyTest < test);
|
||||
CHECK_FALSE(test < emptyTest);
|
||||
CHECK_FALSE(test == test2);
|
||||
};
|
||||
|
||||
SECTION("Comparison test with non-trivial type")
|
||||
@@ -293,6 +300,13 @@ TEST_CASE("Test array type", "[basictypes]")
|
||||
CHECK(test2 < test);
|
||||
CHECK_FALSE(test < test2);
|
||||
CHECK_FALSE(test == test2);
|
||||
|
||||
// ensure in the case of comparing different sized arrays we don't read off the end of one
|
||||
rdcarray<NonTrivial> emptyTest;
|
||||
|
||||
CHECK(emptyTest < test);
|
||||
CHECK_FALSE(test < emptyTest);
|
||||
CHECK_FALSE(test == test2);
|
||||
}
|
||||
|
||||
SECTION("Test constructing/assigning from other types")
|
||||
|
||||
Reference in New Issue
Block a user