You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In calculate_slopes() and pt_in_polygon(), num_saa is the number of points in the SAA polygon. This should correspond to the size of the arrays lat and lon ... meaning that the last valid index of the arrays is (num_saa -1).
In both functions, when the num_saa is used in the for-loop, the last value of i = (num_saa -1). The problem is that the implementation includes the use of lat[i+1] and lon[i+1]. This means that the logic is going out of bounds from the valid memory limits of the array.
The reason why this error is not crashing at runtime is because the two arrays being passed to the functions (from saa() )are of size 52 while the valid data is only 13 entries. (i.e., the array buffer is bigger than num_saa).
Base on the logic in this algorithm the following values will always be invalid:
slopes[0] and intercepts[0] ... this values are never set
slopes[num_ssa -1] and intercepts[num_ssa -1] ... values are based on invalid/unknown values from out-of-bounds lat[num_saa] and lon[num_saa]
The text was updated successfully, but these errors were encountered:
In calculate_slopes() and pt_in_polygon(), num_saa is the number of points in the SAA polygon. This should correspond to the size of the arrays lat and lon ... meaning that the last valid index of the arrays is (num_saa -1).
In both functions, when the num_saa is used in the for-loop, the last value of i = (num_saa -1). The problem is that the implementation includes the use of lat[i+1] and lon[i+1]. This means that the logic is going out of bounds from the valid memory limits of the array.
The reason why this error is not crashing at runtime is because the two arrays being passed to the functions (from saa() )are of size 52 while the valid data is only 13 entries. (i.e., the array buffer is bigger than num_saa).
Base on the logic in this algorithm the following values will always be invalid:
The text was updated successfully, but these errors were encountered: