• Pau Espin Pedrol's avatar
    APER encoding: Fix aper_put_length() with range=65536 · 99b60836
    Pau Espin Pedrol authored
    Fixes bug introduced in 0101252e [1].
    This is actually mainly a revert of that commit.
    
    That commit introduced a bug in which a small value (under 1 octet) with
    range spanning full 2 octets (65536) was encoded incorrectly as 1 octet.
    
    Section 4 of X.691 defines 64K as 65536, and Section 11.5.7 explicitly states
    """
    c) "range" is greater than 256 and less than or equal to 64K (the two-octet case).
    """
    
    This was noted while encoding SBc-AP messaged generated with asn1c,
    where a SEQUENCE OF uses aper_put_length() to set the number of items.
    
    [1] https://github.com/mouse07410/asn1c/pull/91
    99b60836
aper_support.c 6.35 KB