Commit fa5e1c5d authored by Vasil Velichkov's avatar Vasil Velichkov Committed by Mouse

aper: Fix INTEGER encode on 32bit platforms

On i686 the long is 4 bytes and the right shift with more then 32 bits
is probably an undefined behaviour

See https://github.com/vlm/asn1c/issues/185#issuecomment-372546490
parent 3af24898
......@@ -1048,7 +1048,7 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td,
ASN__ENCODE_FAILED;
} else {
/* TODO: extend to >64 bits */
long v64 = v;
int64_t v64 = v;
int i, j;
int max_range_bytes = (ct->range_bits >> 3) +
(((ct->range_bits % 8) > 0) ? 1 : 0);
......@@ -1060,7 +1060,7 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td,
}
for (j = sizeof(int64_t) -1; j != 0; j--) {
uint8_t val;
int64_t val;
val = v64 >> (j * 8);
if (val != 0)
break;
......
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