aboutsummaryrefslogtreecommitdiffstats
path: root/src/gmr1_rx.c
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2011-10-17 22:04:46 +0200
committerSylvain Munaut <tnt@246tNt.com>2011-10-17 22:04:46 +0200
commit8b388923e72956155f15e00bf6a7d44785daaa65 (patch)
tree3c41687eafa5aab32684a61f573101f808b5115a /src/gmr1_rx.c
parentdd331b4b311a7c1afa90e11df037d0310340884b (diff)
apps/gmr1_rx: Protect against negative alignement
In the code we have margin because of START_DISCARD, but if someone modifies that it could cause an unexpected crash. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src/gmr1_rx.c')
-rw-r--r--src/gmr1_rx.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gmr1_rx.c b/src/gmr1_rx.c
index 9f30a8a..c31911b 100644
--- a/src/gmr1_rx.c
+++ b/src/gmr1_rx.c
@@ -168,6 +168,8 @@ fcch_multi_process(struct chan_desc *cd, fcch_multi_cb_t cb)
/* Multi FCCH detection (need 650 ms of signals) */
base_align = cd->align - GMR1_FCCH_SYMS * cd->sps;
+ if (base_align < 0)
+ base_align = 0;
rv = win_map(win, cd->bcch, base_align, (650 * GMR1_SYM_RATE * cd->sps) / 1000);
if (rv) {