Added test for buffer overflow in slic.

As with all buffer overflows, it is hard to make a test that
consistently triggers tests the behavior. This test does not work for me
through the test_slic.py file, but it works in isolation.
This commit is contained in:
Gustav Larsson
2015-04-20 14:35:57 -05:00
parent 841da2b3f8
commit 9de5a4557c
+7
View File
@@ -153,6 +153,12 @@ def test_enforce_connectivity():
enforce_connectivity=False,
convert2lab=False)
# Make sure nothing fatal occurs (e.g. buffer overflow) at low values of
# max_size_factor
segments_connected_low_max = slic(img, 2, compactness=0.0001,
enforce_connectivity=True,
convert2lab=False, max_size_factor=0.8)
result_connected = np.array([[0, 0, 0, 1, 1, 1],
[0, 0, 0, 1, 1, 1],
[0, 0, 0, 1, 1, 1]], np.float)
@@ -163,6 +169,7 @@ def test_enforce_connectivity():
assert_equal(segments_connected, result_connected)
assert_equal(segments_disconnected, result_disconnected)
assert_equal(segments_connected_low_max, result_connected)
def test_slic_zero():