[FFmpeg-devel] [PATCH] misc libvorbis.c fixes
Pascal Massimino
pascal.massimino
Fri Jul 2 08:29:03 CEST 2010
On Tue, Jun 29, 2010 at 12:44 AM, Pascal Massimino <
pascal.massimino at gmail.com> wrote:
> Alex,
>
> On Tue, Jun 29, 2010 at 12:33 AM, Alex Converse <alex.converse at gmail.com>wrote:
>
>> On Tue, Jun 29, 2010 at 3:24 AM, Pascal Massimino
>> <pascal.massimino at gmail.com> wrote:
>> > On Sun, Jun 27, 2010 at 7:40 AM, Carl Eugen Hoyos <cehoyos at ag.or.at>
>> wrote:
>> >
>> >> Pascal Massimino <pascal.massimino <at> gmail.com> writes:
>>
>> Welcome back skal, I hope you'll stay a while.
>>
>
> indeed, been a while...
>
>
>> >> > $subj. Namely:
>> >> > * remove an unneeded av_realloc()
>> >> > * add some buffer checks
>> >> > * use avccontext->frame_size where appropriate
>> >>
>> >> Please send one patch per issue.
>> >>
>> >>
>> > attached.
>> >
>>
>> Normally I'm not one to be pedantic about this sort of thing but...
>>
>> > vorbis-1: remove an unneeded av_realloc()
>> @@ -104,9 +107,10 @@
>> vorbis_analysis_headerout(&context->vd, &context->vc, &header,
>> &header_comm, &header_code);
>>
>> - len = header.bytes + header_comm.bytes + header_code.bytes;
>> - avccontext->extradata_size= 64 + len + len/255;
>> - p = avccontext->extradata= av_mallocz(avccontext->extradata_size);
>> + avccontext->extradata_size=
>> + 1 + xiph_len(header.bytes) + xiph_len(header_comm.bytes)
>> + + header_code.bytes;
>> + p = avccontext->extradata = av_malloc(avccontext->extradata_size);
>> p[0] = 2;
>> offset = 1;
>> offset += av_xiphlacing(&p[offset], header.bytes);
>>
>> This indentation seems really strange.
>>
>
> yeah, i'm unsure what to use here. Here's another try, attached
>
>
>> > vorbis-3: add some buffer checks
>> @@ -190,6 +197,11 @@
>> avccontext->coded_frame->pts= av_rescale_q(op2->granulepos,
>> (AVRational){1, avccontext->sample_rate}, avccontext->time_base);
>> //FIXME we should reorder the user supplied pts and not
>> assume that they are spaced by 1/sample_rate
>>
>> + if (l > buf_size) {
>> + av_log(avccontext, AV_LOG_ERROR, "libvorbis: buffer
>> overflow.");
>> + return -1;
>> + }
>> +
>> memcpy(packets, op2->packet, l);
>> context->buffer_index -= l + sizeof(ogg_packet);
>> memmove(context->buffer, context->buffer + l +
>> sizeof(ogg_packet), context->buffer_index);
>>
>> 4 spaces is the standard indentation in FFmpeg and seems to followed
>> consistently in libvorbis.c
>>
>
> arg yes, only got 1 out of 2 right.
>
>
> skal
>
>
ping? no taker?
More information about the ffmpeg-devel
mailing list