[FFmpeg-devel] [PATCH] Change type to 16 bit.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Apr 26 13:18:13 CEST 2014


On Sat, Apr 26, 2014 at 12:53:50PM +0200, Nicolas George wrote:
> Le septidi 7 floréal, an CCXXII, Reimar Döffinger a écrit :
> > Hm?
> >        res_setup->ptns_to_read =
> >             (res_setup->end - res_setup->begin) / res_setup->partition_size;
> >         /* Validations to prevent a buffer overflow later. */
> >         if (res_setup->begin>res_setup->end ||
> >             res_setup->end > (res_setup->type == 2 ? vc->audio_channels : 1) * vc->blocksize[1] / 2 ||
> >             res_setup->ptns_to_read > V_MAX_PARTITIONS) {
> 
> There is something going on I do not understand, because the code I can see
> at Git HEAD is:
> 
>         res_setup->begin          = get_bits(gb, 24);
>         res_setup->end            = get_bits(gb, 24);
>         res_setup->partition_size = get_bits(gb, 24) + 1;
>         /* Validations to prevent a buffer overflow later. */
>         if (res_setup->begin>res_setup->end ||
>             res_setup->end > (res_setup->type == 2 ? vc->audio_channels : 1) * vc->blocksize[1] / 2 ||
>             (res_setup->end-res_setup->begin) / res_setup->partition_size > V_MAX_PARTITIONS) {
>             av_log(vc->avctx, AV_LOG_ERROR,
>                    "partition out of bounds: type, begin, end, size, blocksize: %"PRIu16", %"PRIu32", %"PRIu32", %u, %"PRIu32"\n",
>                    res_setup->type, res_setup->begin, res_setup->end,
>                    res_setup->partition_size, vc->blocksize[1] / 2);
>             return AVERROR_INVALIDDATA;
>         }
> 
>         res_setup->classifications = get_bits(gb, 6) + 1;
>         GET_VALIDATED_INDEX(res_setup->classbook, 8, vc->codebook_count)
> 
>         res_setup->ptns_to_read =
>             (res_setup->end - res_setup->begin) / res_setup->partition_size;
> 
> It does not seem to have changed recently either.

Oh. My fault.
I worked against my local branch instead of head, and had
changed this.
See an ancient mail with
"vorbisdec: Simplify, do no calculate same value twice."
as subject.
On the one hand I don't know the code so I don't really
want to change it (which is why I didn't commit), but
on the other hand the code doesn't seem good to me.


More information about the ffmpeg-devel mailing list