Skip to content

RAW decoding error, hexstring, HEXORDER (high), FIELDORDER(msb)

Summary

The RAW encoder fails to correctly decode the last digit of hexstring if

  • the hexstring is odd number length and length > 2
  • and variant "HEXORDER (high)"
  • nad variant "FIELDORDER(msb)"

Steps and/or TTCN-3 code to reproduce

module proba{
type record MyRec{
  MCC       mcc,
  bitstring bs length(4)
} with {
  variant "FIELDORDER(msb)"
}

type hexstring MCC
with {
variant "FIELDLENGTH (3)";
variant "FIELDORDER(msb)"
variant "HEXORDER (high)";
}

type component CT{}

template MyRec t_hex:={
  mcc:='042'H,
  bs:='0000'B
}

testcase TChex() runs on CT {
  var bitstring bdata:='0000010000100000'B
  
  var MyRec res
  var integer i:=decvalue(bdata,res)
  log(i)
  if(i!=0){
    setverdict(fail, "decvalue failed")
  } else {
    log(res)
    if(match(res,t_hex)){
      setverdict(pass)
    } else {
      setverdict(fail, "unmatched value")
    }
  }
    
  
}


control {
  execute(TChex())
}
 
} with { encode "RAW" }

What is the current bug behavior?

{ mcc := '040'H, bs := '0000'B }

What is the expected correct behavior?

{ mcc := '042'H, bs := '0000'B }

Titan version

up to 8.0.0

Edited by Adam Knapp