Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i.atcorr: fix out of bound access in trunca, os and iso (#4493)
* i.atcorr: fix out of bound access in trunca, os and iso In trunca(), under 2 if conditionals (if rumu[1] > 0.8 and rmu[1] > 0.94), k and kk values are set to -1 respectively. When these values are used to access an array, it leads to out of bound access, which is undefined behavior in c++. Similarly in os() and iso(), if `taup < h[i]` for all values, iplane would still be -1 and we would be accessing an array with this as an index, which is undefined behavior. In both cases, to avoid that, set that index to zero. This was found using cppcheck tool. Signed-off-by: Mohan Yelugoti <[email protected]> * Update imagery/i.atcorr/computations.cpp When plane layer couldn't be determined, throw out an error and exit. Co-authored-by: Markus Metz <[email protected]> * Update imagery/i.atcorr/computations.cpp When plane layer couldn't be determined, throw out an error and exit. Co-authored-by: Markus Metz <[email protected]> * Fix clang-format issues Signed-off-by: Mohan Yelugoti <[email protected]> --------- Signed-off-by: Mohan Yelugoti <[email protected]> Co-authored-by: Markus Metz <[email protected]>
- Loading branch information