memory problem

git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1373 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
vlm 2007-06-29 17:33:04 +00:00
parent 77a1f66b6f
commit a0a8e7c368
1 changed files with 18 additions and 11 deletions

View File

@ -103,17 +103,24 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
rv = td->uper_decoder(ctx, td, constraints, sptr, &spd); rv = td->uper_decoder(ctx, td, constraints, sptr, &spd);
asn_debug_indent -= 4; asn_debug_indent -= 4;
FREEMEM(buf); if(rv.code == RC_OK) {
/* Check padding validity */
/* Check padding validity */ padding = spd.nbits - spd.nboff;
padding = spd.nbits - spd.nboff; if(padding < 8 && per_get_few_bits(&spd, padding) == 0) {
if(padding >= 8) { /* Everything is cool */
ASN_DEBUG("Too large padding %d in open type", padding); FREEMEM(buf);
_ASN_DECODE_FAILED; return rv;
} else if(per_get_few_bits(&spd, padding)) { }
/* Can't be "no more data", then it's non-zero padding */ FREEMEM(buf);
ASN_DEBUG("Non-zero padding"); if(padding >= 8) {
_ASN_DECODE_FAILED; ASN_DEBUG("Too large padding %d in open type", padding);
_ASN_DECODE_FAILED;
} else {
ASN_DEBUG("Non-zero padding");
_ASN_DECODE_FAILED;
}
} else {
FREEMEM(buf);
} }
return rv; return rv;