File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ fn simple_threshold_vertical(
89
89
90
90
#[ inline]
91
91
fn simple_threshold_horizontal ( filter_limit : i32 , pixels : & [ u8 ] ) -> bool {
92
+ assert ! ( pixels. len( ) >= 6 ) ; // one bounds check up front eliminates all subsequent checks in this function
92
93
i32:: from ( diff ( pixels[ 3 ] , pixels[ 4 ] ) ) * 2 + i32:: from ( diff ( pixels[ 2 ] , pixels[ 5 ] ) ) / 2
93
94
<= filter_limit
94
95
}
@@ -113,6 +114,7 @@ fn should_filter_vertical(
113
114
}
114
115
115
116
fn should_filter_horizontal ( interior_limit : u8 , edge_limit : u8 , pixels : & [ u8 ] ) -> bool {
117
+ assert ! ( pixels. len( ) >= 8 ) ; // one bounds check up front eliminates all subsequent checks in this function
116
118
simple_threshold_horizontal ( i32:: from ( edge_limit) , pixels)
117
119
// this looks like an erroneous way to compute differences between 8 points, but isn't:
118
120
// there are actually only 6 diff comparisons required as per the spec:
You can’t perform that action at this time.
0 commit comments