[FFmpeg-devel] [PATCH] misc libvorbis.c fixes
Pascal Massimino
pascal.massimino
Tue Jun 29 09:44:32 CEST 2010
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vorbis-3.patch
Type: application/octet-stream
Size: 1401 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100629/90c84d07/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vorbis-1.patch
Type: application/octet-stream
Size: 1776 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100629/90c84d07/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vorbis-2.patch
Type: application/octet-stream
Size: 425 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100629/90c84d07/attachment-0002.obj>
More information about the ffmpeg-devel
mailing list