Change in libosmo-netif[master]: amr: fix off-by-one in osmo_amr_bwe_to_oa()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Mon May 25 13:44:37 UTC 2020


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


Change subject: amr: fix off-by-one in osmo_amr_bwe_to_oa()
......................................................................

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
---
M src/amr.c
1 file changed, 1 insertion(+), 1 deletion(-)



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

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 @@
 		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;
 	}

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

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I91e755b83aaac722079879c026d913cc446812d1
Gerrit-Change-Number: 18451
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200525/334c8257/attachment.htm>


More information about the gerrit-log mailing list