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

fixeria gerrit-no-reply at lists.osmocom.org
Sun Feb 16 16:53:49 UTC 2020


fixeria has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/91/17191/1

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-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200216/00f50b43/attachment.htm>


More information about the gerrit-log mailing list