On 29/11/13 13:47, Tim Walker wrote:
> Based on a patch by Michael Niedermayer.
> ---
> libavcodec/dcadec.c | 22 +++++++++++++++++-----
> 1 file changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
> index 50cbf2d..8b50698 100644
> --- a/libavcodec/dcadec.c
> +++ b/libavcodec/dcadec.c
> @@ -1301,8 +1301,10 @@ static int dca_subframe_footer(DCAContext *s, int
> base_channel)
>
> aux_data_end = 8 * aux_data_count + get_bits_count(&s->gb);
>
> - if (get_bits_long(&s->gb, 32) != 0x9A1105A0) // nSYNCAUX
> + if (get_bits_long(&s->gb, 32) != 0x9A1105A0) { // nSYNCAUX
> + av_log(s->avctx,AV_LOG_ERROR, "nSYNCAUX mismatch\n");
Either be informative (and print the mismatching value) or do not print
anything.
> return AVERROR_INVALIDDATA;
> + }
>
> if (get_bits1(&s->gb)) { // bAUXTimeStampFlag
> avpriv_request_sample(s->avctx,
> @@ -1314,7 +1316,8 @@ static int dca_subframe_footer(DCAContext *s, int
> base_channel)
> }
>
> if ((s->core_downmix = get_bits1(&s->gb))) {
> - switch (get_bits(&s->gb, 3)) {
> + int am = get_bits(&s->gb, 3);
> + switch (am) {
> case 0:
> s->core_downmix_amode = DCA_MONO;
> break;
> @@ -1337,13 +1340,20 @@ static int dca_subframe_footer(DCAContext *s, int
> base_channel)
> s->core_downmix_amode = DCA_3F1R;
> break;
> default:
> + av_log(s->avctx, AV_LOG_ERROR,
> + "Invalid mode %d for embedded downmix
> coefficients\n",
> + am);
Seems fine, somebody decided if we should end with a "." the messages or
not?
> return AVERROR_INVALIDDATA;
> }
> for (out = 0; out < dca_channels[s->core_downmix_amode];
> out++) {
> for (in = 0; in < s->prim_channels + !!s->lfe; in++) {
> uint16_t tmp = get_bits(&s->gb, 9);
> - if ((tmp & 0xFF) > 241)
> + if ((tmp & 0xFF) > 241) {
> + av_log(s->avctx, AV_LOG_ERROR,
> + "Invalid downmix coefficient code
> %"PRIu16"\n",
> + tmp);
> return AVERROR_INVALIDDATA;
> + }
> s->core_downmix_codes[in][out] = tmp;
> }
> }
> @@ -1353,9 +1363,11 @@ static int dca_subframe_footer(DCAContext *s, int
> base_channel)
> skip_bits(&s->gb, 16); // nAUXCRC16
>
> // additional data (reserved, cf. ETSI TS 102 114 V1.4.1)
> - if ((reserved = (aux_data_end - get_bits_count(&s->gb))) < 0)
> + if ((reserved = (aux_data_end - get_bits_count(&s->gb))) < 0) {
> + av_log(s->avctx, AV_LOG_ERROR,
> + "Overread auxiliary data by %d bits\n", -reserved);
> return AVERROR_INVALIDDATA;
> - else if (reserved) {
> + } else if (reserved) {
> avpriv_request_sample(s->avctx,
> "Core auxiliary data reserved
> content");
> skip_bits_long(&s->gb, reserved);
The rest seems fine.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel