Attention is currently required from: falconia.
10 comments:
Patchset:
Unless there's really a known use of the low level APIs outside of libosmogsm, I'd rather have them […]
Agreeing with Pau here.
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:
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.
Patch Set #2, 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;
```
Patch Set #2, 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[]`).
Patch Set #2, 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.
Patch Set #2, 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.
Patch Set #2, 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.
Patch Set #2, 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()`?
Patch Set #2, 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 change 44192. To unsubscribe, or for help writing mail filters, visit settings.