diff options
Diffstat (limited to 'apps/dsp.c')
-rw-r--r-- | apps/dsp.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/apps/dsp.c b/apps/dsp.c index cca94ae075..70f1ff46c4 100644 --- a/apps/dsp.c +++ b/apps/dsp.c @@ -769,6 +769,9 @@ void dsp_set_crossfeed(bool enable) void dsp_set_crossfeed_direct_gain(int gain) { crossfeed_data.gain = get_replaygain_int(gain * -10) << 7; + /* If gain is negative, the calculation overflowed and we need to clamp */ + if (crossfeed_data.gain < 0) + crossfeed_data.gain = 0x7fffffff; } void dsp_set_crossfeed_cross_params(long lf_gain, long hf_gain, long cutoff) |