From 92bdfb86ac0ab468586698d068035447b1daf93b Mon Sep 17 00:00:00 2001 From: Tom Tsou Date: Tue, 28 Mar 2017 15:22:01 -0700 Subject: sigProcLib: Check return status on downsampling Improper length values will cause the polyphase resampler rotation to fail. Check return and return NULL on error. Change-Id: I3ad22f9fd7a20754f589c04258dcca3770474a9b Fixes: Coverity CID 165235 --- Transceiver52M/sigProcLib.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Transceiver52M/sigProcLib.cpp') diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 9673d99..4bb41a9 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1962,8 +1962,12 @@ signalVector *downsampleBurst(const signalVector &burst) out = new signalVector(DOWNSAMPLE_OUT_LEN); memcpy(in->begin(), burst.begin(), DOWNSAMPLE_IN_LEN * 2 * sizeof(float)); - dnsampler->rotate((float *) in->begin(), DOWNSAMPLE_IN_LEN, - (float *) out->begin(), DOWNSAMPLE_OUT_LEN); + if (dnsampler->rotate((float *) in->begin(), DOWNSAMPLE_IN_LEN, + (float *) out->begin(), DOWNSAMPLE_OUT_LEN) < 0) { + delete out; + out = NULL; + } + delete in; return out; }; -- cgit v1.2.3