Commit 4e28be09 authored by Vasil Velichkov's avatar Vasil Velichkov

aper: Check CHOICE present value is not greater than elements count

Fixes mouse07410/asn1c#134
parent 29ef59bb
......@@ -40,6 +40,8 @@ CHOICE_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
value = per_get_few_bits(pd, 1);
if(value < 0) ASN__DECODE_STARVED;
if(value) ct = 0; /* Not restricted */
if((unsigned)value >= td->elements_count)
ASN__DECODE_FAILED;
}
if(ct && ct->range_bits >= 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment