protect from SET OF NULL compression bomb

This commit is contained in:
Lev Walkin 2017-10-24 03:29:31 -07:00
parent d8e6bbfa9a
commit 7156898e45
1 changed files with 6 additions and 1 deletions

View File

@ -964,8 +964,13 @@ SET_OF_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
ASN_DEBUG("%s SET OF %s decoded %d, %p",
td->name, elm->type->name, rv.code, ptr);
if(rv.code == RC_OK) {
if(ASN_SET_ADD(list, ptr) == 0)
if(ASN_SET_ADD(list, ptr) == 0) {
if(rv.consumed == 0 && nelems > 200) {
/* Protect from SET OF NULL compression bombs. */
ASN__DECODE_FAILED;
}
continue;
}
ASN_DEBUG("Failed to add element into %s",
td->name);
/* Fall through */