RAW decoder: Set with record/set of field and REPEATABLE(yes)
Submitted by G??bor Szalai
Assigned to G??bor Szalai
Link to original bug (#568518)
Description
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
Example: module proba{
type octetstring OCT1 length(1)
type record IE1{ OCT1 ie_type, integer len, octetstring data } with { variant "PRESENCE(ie_type = '01'O)" variant (len) "LENGTHTO(data)" }
type record IE2{ OCT1 ie_type, integer len, octetstring data } with { variant "PRESENCE(ie_type = '02'O)" variant (len) "LENGTHTO(data)" }
type record unknown_IE{ OCT1 ie_type, integer len, octetstring data } with { variant (len) "LENGTHTO(data)" }
type record of unknown_IE unknown_IE_list
type set PDU{ IE1 ie1_field, IE2 ie2_field optional, unknown_IE_list unknown_ies optional } with { variant (unknown_ies) "REPEATABLE(yes)" }
external function dec_PDU_backtrack(in octetstring stream, out PDU pdu) return integer with { extension "prototype(backtrack) decode(RAW)" }
control{ var octetstring stream; var PDU pdu_decoded; var integer result;
stream := '010100020100030100040100'O // IE1, IE2, unknown IE result:=dec_PDU_backtrack(stream,pdu_decoded); log(stream) log(result) // { ie1_field := { ie_type := '01'O, len := 1, data := '00'O }, ie2_field := { ie_type := '02'O, len := 1, data := '00'O }, unknown_ies := { { ie_type := '03'O, len := 1, data := '00'O }, { ie_type := '04'O, len := 1, data := '00'O } } } log(pdu_decoded)
stream := '010100030100020100040100'O // IE1, unknown IE, IE2 -> IE2 added to the unknown_ies result:=dec_PDU_backtrack(stream,pdu_decoded); log(stream) log(result) // { ie1_field := { ie_type := '01'O, len := 1, data := '00'O }, ie2_field := omit, unknown_ies := { { ie_type := '03'O, len := 1, data := '00'O }, { ie_type := '02'O, len := 1, data := '00'O }, { ie_type := '04'O, len := 1, data := '00'O } } } log(pdu_decoded)
}
} with { encode "RAW" }
Solution: If the record/set of field of the set has variant "REPEATABLE(yes)" decode 1 element of the field at a time.
Version: 7.1.0