• Vasil Velichkov's avatar
    aper: uper: Fix a heap buffer overflow · 839fdd5b
    Vasil Velichkov authored
    When there were no any padding bits the uper and aper decoders where
    trying to read some which results in read past the buffer end.
    
    See https://github.com/mouse07410/asn1c/issues/33#issuecomment-374625610
    
    ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000315 at pc 0x000102ce9c15 bp 0x7fff5d20a8d0 sp 0x7fff5d20a8c8
    READ of size 1 at 0x602000000315 thread T0
        #0 0x102ce9c14 in asn_get_few_bits asn_bit_data.c:132
        #1 0x102d878fd in aper_open_type_get_simple per_opentype.c:455
        #2 0x102d85dcc in aper_open_type_get per_opentype.c:514
    839fdd5b
per_opentype.c 13.4 KB