-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ASan-reported heap-buffer-overflow in GIUH tests #539
Comments
@robertbartel looks like the decrement leaves us with an index of -1 in some cases |
Looking quickly, I think we are prevented from coming across that case because of what the values are and how they are used. But I am pretty sure we can just do this to make the sanitizer happy: diff --git a/src/core/catchment/giuh/GIUH.cpp b/src/core/catchment/giuh/GIUH.cpp
index c86143e09..cab60f7ed 100644
--- a/src/core/catchment/giuh/GIUH.cpp
+++ b/src/core/catchment/giuh/GIUH.cpp
@@ -123,7 +123,7 @@ void giuh_kernel_impl::interpolate_regularized_cdf()
// Find index 'i' of largest CDF time less than the time for the current ordinate
// Start by getting the index of the first time greater than time_for_ordinate
- int cdf_times_index_for_iteration = 0;
+ int cdf_times_index_for_iteration = 1;
while (this->cdf_times[cdf_times_index_for_iteration] < regularized_times_s.back()) {
cdf_times_index_for_iteration++;
} |
To be clear, ASan is a dynamic runtime analysis, not a static analyzer. This isn't a false positive - the case in question actually happened in our tests, and the code actually threw the exception when I changed |
…alid input and UUT is zombie code
Identified in #536
The text was updated successfully, but these errors were encountered: