Fix UPER encoding of empty SEQUENCE OF

A length determinant was not added when the SEQUENCE OF was empty
according to the X.691 #20.6 and #11.9.4.1.

This fixes a failure in 16-SEQUENCE-bundle

Decoding 1 bytes of T yielded RC_WMORE after byte 0
Original random structure:
T ::= {
    list: list ::= {
    }
    guard: 01
}
This commit is contained in:
Vasil Velichkov 2017-10-25 20:56:33 +03:00 committed by Lev Walkin
parent 5fcbb2868d
commit abb7133c23
1 changed files with 8 additions and 0 deletions

View File

@ -183,6 +183,14 @@ SEQUENCE_OF_encode_uper(const asn_TYPE_descriptor_t *td,
ct->effective_bits))
ASN__ENCODE_FAILED;
}
} else if (list->count == 0) {
/* When the list is empty add only the length determinant
* X.691, #20.6 and #11.9.4.1
*/
if (uper_put_length(po, 0, 0)) {
ASN__ENCODE_FAILED;
}
ASN__ENCODED_OK(er);
}