Attention is currently required from: falconia. fixeria has posted comments on this change by falconia. ( https://gerrit.osmocom.org/c/libosmocore/+/44192?usp=email ) Change subject: gsm: new struct and en/decoding functions for BC-IE ...................................................................... Patch Set 2: (10 comments) Patchset: PS2:
Unless there's really a known use of the low level APIs outside of libosmogsm, I'd rather have them […] Agreeing with Pau here.
PS2: Thanks for your contribution! The code looks good in general, but I found a few potential issues. Also, adding a note to TODO-RELEASE and some unit tests would be very welcome, if you have spare cycles for that. File src/gsm/gsm48_ie.c: https://gerrit.osmocom.org/c/libosmocore/+/44192/comment/42b86a34_9b77d066?u... : PS2, Line 341: if (cp >= endp) : return -EINVAL; Shouldn't we check the coding bit (number 7) here? ```suggestion if (cp >= endp) return -EINVAL; if (*cp & 0x40) /* not a speech version octet */ continue; ``` As far as I can see, 24.008 defines no "other extension of octet 3" contents, so we'll unlikely see `coding=1` on the wire in practice. Yet it may be a good idea to skip such octets. https://gerrit.osmocom.org/c/libosmocore/+/44192/comment/b54c8cb6_9633b1c7?u... : PS2, Line 443: hld->v120_params = lld->octet_5_ext[1]; You should mask the extension bit here: ```suggestion hld->v120_params = lld->octet_5_ext[1] & 0x7F; ``` https://gerrit.osmocom.org/c/libosmocore/+/44192/comment/11e85056_fedf6d05?u... : PS2, Line 630: for (n = 0; n < lld->speech.num_vers; n++) { Maybe add an `assert()` before the loop to make sure that `lld->speech.num_vers` does not exceed `OSMO_BCAP_MAX_SPEECH_VER`? Or just return `-E2BIG` / `-EINVAL`? This is not as critical as the decode path, but an error in the given `struct osmo_bcap_ll` should not result in a stack overflow (overrunning the `buf[]`). https://gerrit.osmocom.org/c/libosmocore/+/44192/comment/f156aa07_3bb79a3a?u... : PS2, Line 647: for (n = 0; n < lld->data.extent_of_5; n++) Likewise here (see my comment above): it may be a good idea to check if `lld->data.extent_of_5` is at most `OSMO_BCAP_OCT5_MAX_EXT` bytes long. https://gerrit.osmocom.org/c/libosmocore/+/44192/comment/2e1695f8_a7ed4143?u... : PS2, Line 650: for (n = 0; n < lld->data.extent_of_6; n++) Likewise here (see my comment above): it may be a good idea to check if `lld->data.extent_of_6` is at most `OSMO_BCAP_OCT6_MAX_EXT` bytes long. https://gerrit.osmocom.org/c/libosmocore/+/44192/comment/313abab3_7ec4df2a?u... : PS2, Line 658: if (lv_only) It's worth checking `msgb_tailroom()` here first, since the `msg` comes from a caller and is not guaranteed to have enough room to fit `cp - buf` bytes. https://gerrit.osmocom.org/c/libosmocore/+/44192/comment/092ff950_2a1ff230?u... : PS2, Line 665: bcap_enc_trim_6d_6f AFAICS, this function also handles octet 6g, so maybe rename to `bcap_enc_trim_6d_6g()` or `bcap_enc_term_oct6_ext()`? https://gerrit.osmocom.org/c/libosmocore/+/44192/comment/13c9d71f_623cb4ac?u... : PS2, Line 715: if (hld->other_ra == GSM48_BCAP_OTHER_RA_V120) { `GSM48_BCAP_OTHER_RA_V120` is defined as 0, so `hld->other_ra` indicates V.120 even if it was not set explicitly. This results in octet 5b being emitted when it shouldn't be, e.g. with ITC=other (RDI) and RA=V.110, `other_ra` means nothing but still reads as "V.120", and a bogus 5b gets written: `... 08 00 80 ...`. ```suggestion if (rate_adaption == GSM48_BCAP_RA_OTHER && hld->other_ra == GSM48_BCAP_OTHER_RA_V120) { ``` -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/44192?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ie864734fe1dfd1587bafddd4248ce69a7e066525 Gerrit-Change-Number: 44192 Gerrit-PatchSet: 2 Gerrit-Owner: falconia <falcon@freecalypso.org> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: fixeria <vyanitskiy@sysmocom.de> Gerrit-CC: pespin <pespin@sysmocom.de> Gerrit-Attention: falconia <falcon@freecalypso.org> Gerrit-Comment-Date: Mon, 30 Nov 2026 14:19:16 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin@sysmocom.de>