pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/30223 )


Change subject: amr: Guard against incorrect AMR FT passed to 
osmo_amr_{bits,bytes}()
......................................................................

amr: Guard against incorrect AMR FT passed to osmo_amr_{bits,bytes}()

Fixes: Coverity CID#283433
Change-Id: Ib11d4b64c6df19a85c4374fde89e1b56f410e438
---
M src/amr.c
1 file changed, 4 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/23/30223/1

diff --git a/src/amr.c b/src/amr.c
index 6ed5b6c..1b750eb 100644
--- a/src/amr.c
+++ b/src/amr.c
@@ -14,6 +14,8 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdbool.h>
+
+#include <osmocom/core/utils.h>
 #include <osmocom/netif/amr.h>

 /* According to TS 26.101:
@@ -56,11 +58,13 @@

 size_t osmo_amr_bits(uint8_t amr_ft)
 {
+       OSMO_ASSERT(amr_ft < AMR_FT_MAX);
        return amr_ft_to_bits[amr_ft];
 }

 size_t osmo_amr_bytes(uint8_t amr_ft)
 {
+       OSMO_ASSERT(amr_ft < AMR_FT_MAX);
        return amr_ft_to_bytes[amr_ft];
 }


--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30223
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ib11d4b64c6df19a85c4374fde89e1b56f410e438
Gerrit-Change-Number: 30223
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to