• Bi-Ruei, Chiu's avatar
    Fix the problem that user supplied value not used in APER · bf70e374
    Bi-Ruei, Chiu authored
    For the following examplified ASN.1,
    
      TEST DEFINITIONS AUTOMATIC TAGS ::=
      BEGIN
    
      S1 ::= SEQUENCE  {
        fn INTEGER,
        fb BIT STRING DEFAULT 'A5'H,
        fc OCTET STRING DEFAULT 'FFAABB'H
      }
    
      END
    
    and input XER as :
    
      <S1>
        <fn>9845</fn>
        <fc>DEAD9</fc>
      </S1>
    
    The encoded APER should be :
    
      S1 ::= {
        fn: 9845
        fb: A5
        fc: DE AD 90
      }
    
    but current output is
    
      S1 ::= {
        fn: 9845
        fb: A5
        fc: FF AA BB
      }
    
    The reason is in SEQUENCE_encode_aper(), default_value_cmp() are
    incorrectly checked against 1.
    
    If the input value is equal to default value, this return value from
    compare function is 0.
    bf70e374
constr_SEQUENCE.c 57.1 KB