Commit f12568d6 authored by Bi-Ruei, Chiu's avatar Bi-Ruei, Chiu

Fix incorrect UPER encoding for empty extensible SEQUENCE in 38.331

For empty extensible SEQUENCE type, e.g.

  searchSpaceType              CHOICE {
    common                       SEQUENCE {
      dci-Format0-0-AndFormat1-0     SEQUENCE {
        ...
      }                                                           OPTIONAL,   -- Need R
      dci-Format2-0                SEQUENCE {
        nrofCandidates-SFI           SEQUENCE {
          aggregationLevel1            ENUMERATED {n1, n2}        OPTIONAL,   -- Need R
          aggregationLevel2            ENUMERATED {n1, n2}        OPTIONAL,   -- Need R
          aggregationLevel4            ENUMERATED {n1, n2}        OPTIONAL,   -- Need R
          aggregationLevel8            ENUMERATED {n1, n2}        OPTIONAL,   -- Need R
          aggregationLevel16           ENUMERATED {n1, n2}        OPTIONAL    -- Need R
        },
        ...
      }                                                         OPTIONAL,   -- Need R
      dci-Format2-1                SEQUENCE {
        ...
      }                                                         OPTIONAL,   -- Need R
      dci-Format2-2                SEQUENCE {
        ...
      }                                                         OPTIONAL,   -- Need R
      dci-Format2-3                SEQUENCE {
        dummy1                       ENUMERATED {sl1, sl2, sl4, sl5, sl8, sl10, sl16, sl20}    OPTIONAL,   -- Cond Setup
        dummy2                       ENUMERATED {n1, n2},
        ...
      }                                                         OPTIONAL    -- Need R
    },
    ue-Specific                    SEQUENCE {
      dci-Formats                    ENUMERATED {formats0-0-And-1-0, formats0-1-And-1-1},
      ...
    }
  }

According to X.691 :

  If the sequence type has an extension marker in the "ComponentTypeLists"
  or in the "SequenceType" productions, then a single bit shall first be added to
  the field-list in a bit-field of length one.

So for dci-Format0-0-AndFormat1-0, dci-Format2-1 and dci-Format2-2,
even they are empty without other fields, there shall be still one extension bit
to be added.

Use compute_extensions_start() to determine position of extension in
asn1c_lang_C_type_SEQUENCE_def() to fix this problem.
parent 4e7edb05
......@@ -425,7 +425,7 @@ asn1c_lang_C_type_SEQUENCE_def(arg_t *arg, asn1c_ioc_table_and_objset_t *opt_ioc
asn1p_expr_t *expr = arg->expr;
asn1p_expr_t *v;
int elements; /* Number of elements */
int first_extension = -1;
int first_extension = compute_extensions_start(expr);
tag2el_t *tag2el = NULL;
int tag2el_count = 0;
int tags_count;
......
......@@ -161,7 +161,7 @@ asn_SEQUENCE_specifics_t asn_SPC_Error_specs_1 = {
0, /* No top level tags */
0, /* No tags in the map */
0, 0, 0, /* Optional elements (not needed) */
-1, /* First extension addition */
0, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_Error = {
"Error",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment