mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-08-26 05:15:40 -04:00
rtl-sdr: Fix out-of-bounds access in gain selection
The gain change handler allowed an index equal to m_gains.size(), which is outside the valid vector range. Reject invalid indices before accessing the gain table to avoid undefined behavior. found with cppcheck: Access out of bounds Signed-off-by: Robin Getz <rgetz503@gmail.com>
This commit is contained in:
@@ -394,7 +394,7 @@ void RTLSDRGui::on_ppm_valueChanged(int value)
|
||||
|
||||
void RTLSDRGui::on_gain_valueChanged(int value)
|
||||
{
|
||||
if (value > (int)m_gains.size()) {
|
||||
if (value < 0 || value >= (int)m_gains.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user