From 4e28be09549f3ad6ee4fd5e84996899671591a36 Mon Sep 17 00:00:00 2001 From: Vasil Velichkov Date: Mon, 13 Nov 2023 21:42:39 +0200 Subject: [PATCH] aper: Check CHOICE present value is not greater than elements count Fixes mouse07410/asn1c#134 --- skeletons/constr_CHOICE_aper.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/skeletons/constr_CHOICE_aper.c b/skeletons/constr_CHOICE_aper.c index 41040aaee..0d356f7f9 100644 --- a/skeletons/constr_CHOICE_aper.c +++ b/skeletons/constr_CHOICE_aper.c @@ -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) {