summaryrefslogtreecommitdiff
path: root/cesar/mac/pbproc
diff options
context:
space:
mode:
authorNélio Laranjeiro2012-10-30 10:11:43 +0100
committerNélio Laranjeiro2012-12-12 14:08:20 +0100
commite22ab5d3ecd40ba7a06bb405cd4959844dcb559a (patch)
tree7c36bdf8046e33a2c4646e21db7f24184ec58a88 /cesar/mac/pbproc
parentfbf449af07d39f16eb0ba6438cd25b607216f9e6 (diff)
cesar/mac/pbproc: do not handle sound with invalid rsc, closes #2658
Diffstat (limited to 'cesar/mac/pbproc')
-rw-r--r--cesar/mac/pbproc/src/fsm_handle_fc.c6
-rw-r--r--cesar/mac/pbproc/test/pbproc/src/rx_sound.c20
2 files changed, 23 insertions, 3 deletions
diff --git a/cesar/mac/pbproc/src/fsm_handle_fc.c b/cesar/mac/pbproc/src/fsm_handle_fc.c
index f31346bfa5..f32f62206c 100644
--- a/cesar/mac/pbproc/src/fsm_handle_fc.c
+++ b/cesar/mac/pbproc/src/fsm_handle_fc.c
@@ -292,7 +292,11 @@ pbproc_fhfc_sound (pbproc_t *ctx, u32 rx_date, const pbproc_fc_sound_t *sound)
if (sound->access == false
&& sound->snid == ctx->alloc.snid
&& sound->dtei == ctx->config->tei
- && !sound->saf)
+ && !sound->saf
+ && ((sound->src <= TONEMAP_SRC_TMI_MAX
+ && sound->src >= TONEMAP_SRC_TMI_MIN)
+ || sound->src >= TONEMAP_SRC_ERROR)
+ )
{
pbproc_frso__handle (ctx, rx_date, sound);
}
diff --git a/cesar/mac/pbproc/test/pbproc/src/rx_sound.c b/cesar/mac/pbproc/test/pbproc/src/rx_sound.c
index cce0197779..f63d33d67d 100644
--- a/cesar/mac/pbproc/test/pbproc/src/rx_sound.c
+++ b/cesar/mac/pbproc/test/pbproc/src/rx_sound.c
@@ -228,6 +228,8 @@ enum rx_sound_nfu_t
{
NFU_OUT_OF_ALLOC,
NFU_POOL_SHORTAGE,
+ NFU_SRC_RSVD_TMI_MIN,
+ NFU_SRC_RSVD_TMI_MAX,
};
typedef enum rx_sound_nfu_t rx_sound_nfu_t;
@@ -277,6 +279,10 @@ rx_sound_nfu_test (test_t t, test_pbproc_t *tp, u32 date, rx_sound_nfu_t nfu)
.reserved2 = 0,
.fccs_av = 0,
};
+ if (nfu == NFU_SRC_RSVD_TMI_MIN)
+ sound_fc.src = TONEMAP_SRC_TMI_MIN - 1;
+ else if (nfu == NFU_SRC_RSVD_TMI_MAX)
+ sound_fc.src = TONEMAP_SRC_TMI_MAX + 1;
length_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
+ MAC_FL_TO_TCK (MAC_TCK_TO_FL (fl_tck))
+ MAC_PREAMBLE_TCK + MAC_FC_AV_TCK + MAC_CIFS_TCK;
@@ -308,9 +314,14 @@ rx_sound_nfu_test (test_t t, test_pbproc_t *tp, u32 date, rx_sound_nfu_t nfu)
t, tp,
.prp_lost = 0,
.rx_handle_fc = 1,
- .rx_sound = 1,
+ .rx_sound =
+ nfu == NFU_SRC_RSVD_TMI_MIN || nfu == NFU_SRC_RSVD_TMI_MAX ?
+ 0 : 1,
.rx_out_of_alloc = nfu == NFU_OUT_OF_ALLOC ? 1 : 0,
- .rx_pool_shortage = nfu == NFU_POOL_SHORTAGE ? 1 : 0);
+ .rx_pool_shortage = nfu == NFU_POOL_SHORTAGE ? 1 : 0,
+ .rx_nfu =
+ nfu == NFU_SRC_RSVD_TMI_MIN || nfu == NFU_SRC_RSVD_TMI_MAX ?
+ 1 : 0);
test_fail_unless (tp->pbproc->fsm.current_state == PBPROC_FSM_STATE_IDLE);
test_fail_unless (tp->pbproc->rx_pool_size == (nfu != NFU_POOL_SHORTAGE
? 4 : 3));
@@ -332,6 +343,11 @@ rx_sound_error_test_case (test_t t)
{
rx_sound_nfu_test (t, &tp, 123456, NFU_POOL_SHORTAGE);
} test_end;
+ test_begin (t, "nfu src reserved")
+ {
+ rx_sound_nfu_test (t, &tp, 123456, NFU_SRC_RSVD_TMI_MIN);
+ rx_sound_nfu_test (t, &tp, 123456, NFU_SRC_RSVD_TMI_MAX);
+ } test_end;
test_pbproc_uninit (&tp);
}