From 24df09052e013f89a609ebe0ce7c5c9009651986 Mon Sep 17 00:00:00 2001
From: Botond Baranyi <botond.baranyi@ericsson.com>
Date: Wed, 4 Apr 2018 16:25:20 +0200
Subject: [PATCH] Fixed RAW encoding of INT_MIN... for real this time (bug
 533067)

Change-Id: I5d6ed79fbb652c0498a23215b64b1b62897bef11
Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com>
---
 core/Integer.cc                                    | 3 +--
 function_test/RAW_EncDec/RAW_EncDec_TD.fast_script | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/core/Integer.cc b/core/Integer.cc
index 1301fae04..5bb5217ca 100644
--- a/core/Integer.cc
+++ b/core/Integer.cc
@@ -1132,8 +1132,7 @@ int INTEGER::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf)
     value = 0;
     neg_sgbit = FALSE;
   }
-  if (value != 0 && value == -value) {
-    // value == -INT_MAX-1 a.k.a. INT_MIN a.k.a. 0x8000....
+  if (value == INT_MIN) {
     INTEGER big_value(to_openssl(val.native)); // too big for native
     return big_value.RAW_encode_openssl(p_td, myleaf);
   }
diff --git a/function_test/RAW_EncDec/RAW_EncDec_TD.fast_script b/function_test/RAW_EncDec/RAW_EncDec_TD.fast_script
index 560c4861e..2499997bd 100644
--- a/function_test/RAW_EncDec/RAW_EncDec_TD.fast_script
+++ b/function_test/RAW_EncDec/RAW_EncDec_TD.fast_script
@@ -2679,7 +2679,7 @@ testcase TC_record_with_EXTENSION_BIT_5() runs on TempComp{
 
 
   if ((enc_RAW_PDU_127(i) == o)and(dec_RAW_PDU_127(o) == i )) {setverdict(pass);}
-  else {setverdict(fail,"enc_RAW_PDU_127(i)= ", enc_RAW_PDU_127(i), "; dec_RAW_PDU_127(o)= ", dec_RAW_PDU_127(o));}}
+  else {setverdict(fail,"enc_RAW_PDU_127(i)= ", enc_RAW_PDU_127(i), "; dec_RAW_PDU_127(o)= ", dec_RAW_PDU_127(o));}
 }
 
 // Test of  record with EXTENSION_BIT 6
-- 
GitLab