diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-01-18 16:05:03 -0800 |
---|---|---|
committer | Brent Stapleton <brent.stapleton@ettus.com> | 2019-01-21 18:13:33 -0800 |
commit | 33233e5c77f495a54d21bd949ea9c7d3a9634e87 (patch) | |
tree | c410286ec436e3d8d5aa3d7348ffb582f121005c | |
parent | 86932606e3fe6b7ec89183e7f63252148047ad42 (diff) | |
download | uhd-33233e5c77f495a54d21bd949ea9c7d3a9634e87.tar.gz uhd-33233e5c77f495a54d21bd949ea9c7d3a9634e87.tar.bz2 uhd-33233e5c77f495a54d21bd949ea9c7d3a9634e87.zip |
examples: Fix boundary condition in ascii_art_dft plotting
There was a corner case where the data could be such that the FFT plot
symbol selection would cause an out-of-bounds access on the symbols
table, and abort the example with an uncaught exception.
-rw-r--r-- | host/examples/ascii_art_dft.hpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/host/examples/ascii_art_dft.hpp b/host/examples/ascii_art_dft.hpp index 19099cbf8..84c008bbf 100644 --- a/host/examples/ascii_art_dft.hpp +++ b/host/examples/ascii_art_dft.hpp @@ -258,7 +258,7 @@ std::string dft_to_plot(const log_pwr_dft_type& dft_, (val - (ref_lvl - dyn_rng)) * (frame.get_plot_h() - 1) / dyn_rng; for (size_t z = 0; z < frame.get_plot_h(); z++) { static const std::string syms(".:!|"); - if (scaled - z > 1) + if (scaled - z >= 1) frame.get_plot(b, z) = syms.at(syms.size() - 1); else if (scaled - z > 0) frame.get_plot(b, z) = syms.at(size_t((scaled - z) * syms.size())); |