aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2020-05-25 15:39:35 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2020-05-25 17:05:04 +0200
commitb61eaaccc37c8e7842a86bc06dcd0c0dd444e576 (patch)
tree194384463e602d62bb9143b6eae753ae767160e5 /src
parent51591bbc3f6264404d02f23fc7caaa4e1f9a090e (diff)
amr: fix off-by-one in osmo_amr_bwe_to_oa()
The for loop in osmo_amr_bwe_to_oa, that converts the body part of the AMR payload runs one byte too far. This may cause that some of the padding bits in the end are not set to zero. The loop is designed to convert n-1 bytes and the nth byte is done separately at the end. Change-Id: I91e755b83aaac722079879c026d913cc446812d1
Diffstat (limited to 'src')
-rw-r--r--src/amr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/amr.c b/src/amr.c
index 980d6ad..2706432 100644
--- a/src/amr.c
+++ b/src/amr.c
@@ -198,7 +198,7 @@ int osmo_amr_bwe_to_oa(uint8_t *payload, unsigned int payload_len,
return -1;
oa_payload_len = 2 + osmo_amr_bytes(oa_hdr->ft);
- for (i = 0; i < oa_payload_len - 2; i++) {
+ for (i = 0; i < oa_payload_len - 3; i++) {
buf[i + 2] = payload[i + 1] << 2;
buf[i + 2] |= payload[i + 2] >> 6;
}