From f5dc5cc6358a153cd0e0da503563c595d2a2edd4 Mon Sep 17 00:00:00 2001 From: Vasil Velichkov Date: Wed, 14 Mar 2018 04:35:09 +0200 Subject: [PATCH] aper: Fix decode of big unsigned integers on 32bit platforms On i686 the long is 4 bytes and when converted to uint64_t some big unsigned values get converted to very big negative values See https://github.com/vlm/asn1c/issues/185#issuecomment-372546490 --- skeletons/INTEGER.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skeletons/INTEGER.c b/skeletons/INTEGER.c index d59ee37b6..79e747b79 100644 --- a/skeletons/INTEGER.c +++ b/skeletons/INTEGER.c @@ -879,7 +879,7 @@ INTEGER_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, value += ct->lower_bound; if((specs && specs->field_unsigned) - ? asn_uint642INTEGER(st, value) + ? asn_uint642INTEGER(st, (unsigned long)value) : asn_int642INTEGER(st, value)) ASN__DECODE_FAILED; ASN_DEBUG("Got value %ld + low %ld",