y_ctb can be zero while border_pixels, w and x are all non-negative, resulting in a left shift of a negative value which is UB. In the case y_ctb is 0, edges[TOP] is 1, hence the result is not used, but changing the order of operations removes the UB and makes undefined behaviour sanitizers happy.
y_ctb
can be zero whileborder_pixels
,w
andx
are all non-negative, resulting in a left shift of a negative value which is UB. In the casey_ctb
is 0,edges[TOP]
is 1, hence the result is not used, but changing the order of operations removes the UB and makes undefined behaviour sanitizers happy.