Change in osmo-pcu[master]: csn1: fix existNextElement(): use bitvec_get_bit_pos()

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/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Feb 17 21:58:39 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/17191 )

Change subject: csn1: fix existNextElement(): use bitvec_get_bit_pos()
......................................................................

csn1: fix existNextElement(): use bitvec_get_bit_pos()

As was discovered recently (see OS#4388), bitvec_read_field()
would never return a negative value because its return type
is unsigned (uint64_t).

We don't really need to get more than one bit, so let's just
use the bitvec_get_bit_pos() instead.

Change-Id: I763a295cd955cd33f542292c85d97ff82f6b49bc
Related: OS#4388
---
M src/csn1.cpp
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/csn1.cpp b/src/csn1.cpp
index 5928d69..7be28a1 100644
--- a/src/csn1.cpp
+++ b/src/csn1.cpp
@@ -137,7 +137,7 @@
 static gboolean
 existNextElement(bitvec *vector, unsigned& readIndex, guint8 Tag)
 {
-  guint8 res = bitvec_read_field(vector, &readIndex, 1);
+  int res = bitvec_get_bit_pos(vector, readIndex++);
   if (Tag == STANDARD_TAG)
   {
     return (res > 0);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/17191
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I763a295cd955cd33f542292c85d97ff82f6b49bc
Gerrit-Change-Number: 17191
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
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/20200217/063536f9/attachment.htm>


More information about the gerrit-log mailing list