RAW: invalid decoding of octetstring field with LENGTHTO attribute
An octetstring field with the LENGTHTO attribute is not decoded correctly.
type record Rec {
charstring str1,
charstring str2,
octetstring len
}
with {
encode "RAW";
variant (str1) "FIELDLENGTH(4)";
variant (str2) "FIELDLENGTH(3)";
variant (len) "FIELDLENGTH(2)";
variant (len) "LENGTHTO(str1, str2)";
variant (len) "BYTEORDER(first)";
variant (len) "BITORDER(msb)";
}
control {
var Rec x := { "abcd", "xyz", 'ABCD'O };
action(bit2oct(encvalue(x))); // 61626364 78797A E000
var bitstring y := encvalue(x);
action(decvalue(y, x));
action(x); // { str1 := "abcd", str2 := "xyz", len := '00E0'O }
}
In the example field 'len' should be '0007'O after decoding, regardless of other coding attributes.
/cc @aknappqwt @mmagyari