mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-12 12:30:16 +08:00
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:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user