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.orgdexter has submitted this change. ( 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 M tests/amr/amr_test.c M tests/amr/amr_test.ok 3 files changed, 10 insertions(+), 10 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved 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; } diff --git a/tests/amr/amr_test.c b/tests/amr/amr_test.c index 2f41fe9..fabf948 100644 --- a/tests/amr/amr_test.c +++ b/tests/amr/amr_test.c @@ -46,7 +46,7 @@ "100c1fb967f7f1fdf547bf2e61c060", "0004f89d67f1160935bde1996840", "0004633cc7f0630439ffe0000000", - "0004eb81fc0758973b9edc782552", + "0004eb81fc0758973b9edc782550", "a078ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00fc", /* sample with invalid FT */ "END", }; diff --git a/tests/amr/amr_test.ok b/tests/amr/amr_test.ok index af1be82..eea513b 100644 --- a/tests/amr/amr_test.ok +++ b/tests/amr/amr_test.ok @@ -143,10 +143,10 @@ rc: 14 Sample No.: 20 - octet aligned: 0004eb81fc0758973b9edc782552 - 0000000000000100111010111000000111111100000001110101100010010111001110111001111011011100011110000010010101010010 - bw-efficient: 007ae07f01d625cee7b71e095480 - 0000000001111010111000000111111100000001110101100010010111001110111001111011011100011110000010010101010010000000 + octet aligned: 0004eb81fc0758973b9edc782550 + 0000000000000100111010111000000111111100000001110101100010010111001110111001111011011100011110000010010101010000 + bw-efficient: 007ae07f01d625cee7b71e095400 + 0000000001111010111000000111111100000001110101100010010111001110111001111011011100011110000010010101010000000000 rc: 14 Sample No.: 21 @@ -162,15 +162,15 @@ Sample No.: 0 bw-efficient: f4495c7cda8f80 11110100010010010101110001111100110110101000111110000000 - octet aligned: f0442571f36a3e - 11110000010001000010010101110001111100110110101000111110 + octet aligned: f0442571f36a3c + 11110000010001000010010101110001111100110110101000111100 rc: 7 Sample No.: 1 bw-efficient: f44aaa6c969780 11110100010010101010101001101100100101101001011110000000 - octet aligned: f0442aa9b25a5e - 11110000010001000010101010101001101100100101101001011110 + octet aligned: f0442aa9b25a5c + 11110000010001000010101010101001101100100101101001011100 rc: 7 Sample No.: 2 -- 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: 2 Gerrit-Owner: dexter <pmaier at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200602/fd3ab547/attachment.htm>