Skip to content

Commit

Permalink
Validate XXCH downmix channel mapping mask.
Browse files Browse the repository at this point in the history
Prevents possible NULL pointer dereference due to invalid mask read from
the bitstream.
  • Loading branch information
foo86 committed Dec 14, 2015
1 parent 76f1ca4 commit a4a3e9a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libdcadec/core_decoder.c
Expand Up @@ -310,8 +310,14 @@ static int parse_coding_header(struct core_decoder *core, enum HeaderType header
}

// Downmix channel mapping mask
for (ch = xch_base; ch < core->nchannels; ch++)
core->dmix_mask[ch] = bits_get(&core->bits, core->xxch_mask_nbits);
for (ch = xch_base; ch < core->nchannels; ch++) {
mask = bits_get(&core->bits, core->xxch_mask_nbits);
if ((mask & core->xxch_core_mask) != mask) {
core_err("Invalid XXCH downmix channel mapping mask (%#x)", mask);
return -DCADEC_EBADDATA;
}
core->dmix_mask[ch] = mask;
}

// Downmix coefficients
int *coeff_ptr = core->dmix_coeff;
Expand Down

0 comments on commit a4a3e9a

Please sign in to comment.