laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/43236?usp=email )
Change subject: bits: Fix osmo_pbit2ubit() reading extra input byte on num_bits%8==0 ...................................................................... bits: Fix osmo_pbit2ubit() reading extra input byte on num_bits%8==0 For instance, if num_bits was 0, it would read in[0], which is unexpected. Related: OS#7052 Reported-By: Adam Bedard <[email protected]> Change-Id: I3ec32631440f3df48627eac3ec4cefae32ef7244 --- M src/core/bits.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve osmith: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/core/bits.c b/src/core/bits.c index a4c0970..fc41d4a 100644 --- a/src/core/bits.c +++ b/src/core/bits.c @@ -148,7 +148,7 @@ ubit_t *cur = out; ubit_t *limit = out + num_bits; - for (i = 0; i < (num_bits/8)+1; i++) { + for (i = 0; i < ((num_bits + 7) / 8); i++) { pbit_t byte = in[i]; *cur++ = (byte >> 7) & 1; if (cur >= limit) -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/43236?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I3ec32631440f3df48627eac3ec4cefae32ef7244 Gerrit-Change-Number: 43236 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <[email protected]> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <[email protected]> Gerrit-Reviewer: laforge <[email protected]> Gerrit-Reviewer: osmith <[email protected]>
