From 3bcd45754408b10fb15c46878597a7f19dc8cf68 Mon Sep 17 00:00:00 2001
From: Gabor Szalai <gabor.szalai@ericsson.com>
Date: Wed, 4 Nov 2020 10:08:44 +0100
Subject: [PATCH] Bug 568518  Raw decoder correction

The RAW decoder incorrectly decodes the set with a record of type field if:
- The record of field has a variant:  REPEATABLE(yes)
- It is a "catch all unknonw IE" list

The problem is that the "catch all unknonw IE" list field can consume all IEs

Solution:
If the record/set of field of the set has variant "REPEATABLE(yes)"
decode 1 element of the field at a time.

Change-Id: I274015ec7fe8194438a9a8d6e7b995bcba6367f4
---
 compiler2/record.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler2/record.c b/compiler2/record.c
index 18df9ba0e..a8f1eb0c0 100644
--- a/compiler2/record.c
+++ b/compiler2/record.c
@@ -379,10 +379,10 @@ char* generate_raw_coding(char* src,
       "RAW_Force_Omit field_%d_force_omit(%d, force_omit, "
       "%s_descr_.raw->forceomit);\n"
 	    "int decoded_field_length = field_%s%s.RAW_decode(%s_descr_, "
-	      "p_buf, limit, local_top_order, TRUE, -1, ",
+	      "p_buf, limit, local_top_order, TRUE, %s, ",
       i, i, sdef->elements[i].typedescrname,
 	    sdef->elements[i].name, sdef->elements[i].isOptional ? "()" : "",
-	    sdef->elements[i].typedescrname);
+	    sdef->elements[i].typedescrname, repeatable?"1":"-1");
 	  if (repeatable)
             src = mputprintf(src, "field_map[%lu] == 0",
               (unsigned long) i);
-- 
GitLab