From 32e4887b00586edf24052fdf8812e14aa57e8c25 Mon Sep 17 00:00:00 2001
From: Kristof Szabados <Kristof.Szabados@ericsson.com>
Date: Wed, 8 Aug 2018 14:21:01 +0200
Subject: [PATCH] OER fix: in case of unsigned integers shifting should start
 with 8 bits.

Signed-off-by: Kristof Szabados <Kristof.Szabados@ericsson.com>
---
 core/Integer.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/core/Integer.cc b/core/Integer.cc
index ae9d88a66..88509c137 100644
--- a/core/Integer.cc
+++ b/core/Integer.cc
@@ -1800,7 +1800,11 @@ int INTEGER::OER_encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf) c
     size_t len = 1;
     // No length restriction on integer
     if (p_td.oer->bytes == -1) {
-      ulong_val >>= 7;
+      if (p_td.oer->signed_) {
+        ulong_val >>= 7;
+      } else {
+        ulong_val >>= 8;
+      }
       while (ulong_val != 0) {
         len++;
         ulong_val >>= 8;
-- 
GitLab