Apply velichkov's s1ap branch update

This commit is contained in:
Sukchan Lee 2018-03-22 15:55:52 +09:00
parent 62eed38e63
commit 6ff80f4457
4 changed files with 12 additions and 13 deletions

View File

@ -356,13 +356,14 @@ BOOLEAN_encode_aper(const asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints,
const void *sptr, asn_per_outp_t *po) {
const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
asn_enc_rval_t er;
asn_enc_rval_t er = { 0, 0, 0 };
(void)constraints;
if(!st) ASN__ENCODE_FAILED;
per_put_few_bits(po, *st ? 1 : 0, 1);
if(per_put_few_bits(po, *st ? 1 : 0, 1))
ASN__ENCODE_FAILED;
ASN__ENCODED_OK(er);
}

View File

@ -507,7 +507,7 @@ INTEGER__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr,
/* The last symbol encountered was a digit. */
switch(asn_strtoimax_lim(dec_value_start, &dec_value_end, &dec_value)) {
case ASN_STRTOX_OK:
if(specs && specs->field_unsigned && dec_value <= ULONG_MAX) {
if(specs && specs->field_unsigned && (uintmax_t) dec_value <= ULONG_MAX) {
break;
} else if(dec_value >= LONG_MIN && dec_value <= LONG_MAX) {
break;

View File

@ -1623,10 +1623,10 @@ SEQUENCE_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
uint8_t *epres; /* Presence of extension members */
asn_per_data_t epmd;
bmlength = uper_get_nslength(pd);
bmlength = aper_get_nslength(pd);
if(bmlength < 0) ASN__DECODE_STARVED;
ASN_DEBUG("Extensions %ld present in %s", bmlength, td->name);
ASN_DEBUG("Extensions %" ASN_PRI_SSIZE " present in %s", bmlength, td->name);
epres = (uint8_t *)MALLOC((bmlength + 15) >> 3);
if(!epres) ASN__DECODE_STARVED;
@ -1668,7 +1668,7 @@ SEQUENCE_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
}
ASN_DEBUG("Decoding member %s in %s %p", elm->name, td->name, *memb_ptr2);
rv = uper_open_type_get(opt_codec_ctx, elm->type,
rv = aper_open_type_get(opt_codec_ctx, elm->type,
elm->encoding_constraints.per_constraints, memb_ptr2, pd);
if(rv.code != RC_OK) {
FREEMEM(epres);
@ -1686,7 +1686,7 @@ SEQUENCE_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
case 0:
continue;
default:
if(uper_open_type_skip(opt_codec_ctx, pd)) {
if(aper_open_type_skip(opt_codec_ctx, pd)) {
FREEMEM(epres);
ASN__DECODE_STARVED;
}

View File

@ -119,7 +119,7 @@ uper_open_type_get_simple(const asn_codec_ctx_t *ctx,
if(rv.code == RC_OK) {
/* Check padding validity */
padding = spd.nbits - spd.nboff;
if ((padding < 8 ||
if (((padding > 0 && padding < 8) ||
/* X.691#10.1.3 */
(spd.nboff == 0 && spd.nbits == 8 && spd.buffer == buf)) &&
per_get_few_bits(&spd, padding) == 0) {
@ -132,8 +132,7 @@ uper_open_type_get_simple(const asn_codec_ctx_t *ctx,
ASN_DEBUG("Too large padding %d in open type", (int)padding);
ASN__DECODE_FAILED;
} else {
ASN_DEBUG("Non-zero padding");
ASN__DECODE_FAILED;
ASN_DEBUG("No padding");
}
} else {
FREEMEM(buf);
@ -449,7 +448,7 @@ aper_open_type_get_simple(const asn_codec_ctx_t *ctx,
if(rv.code == RC_OK) {
/* Check padding validity */
padding = spd.nbits - spd.nboff;
if ((padding < 8 ||
if (((padding > 0 && padding < 8) ||
/* X.691#10.1.3 */
(spd.nboff == 0 && spd.nbits == 8 && spd.buffer == buf)) &&
per_get_few_bits(&spd, padding) == 0) {
@ -462,8 +461,7 @@ aper_open_type_get_simple(const asn_codec_ctx_t *ctx,
ASN_DEBUG("Too large padding %d in open type", (int)padding);
ASN__DECODE_FAILED;
} else {
ASN_DEBUG("Non-zero padding");
ASN__DECODE_FAILED;
ASN_DEBUG("No padding");
}
} else {
FREEMEM(buf);