[FFmpeg-devel] [PATCH 5/5] libxvid: Reduce the size of an array

Michael Niedermayer michaelni at gmx.at
Sun Aug 4 04:24:04 CEST 2013


On Sat, Aug 03, 2013 at 05:00:12PM -0700, Timothy Gu wrote:
> On Thu, Aug 1, 2013 at 5:27 PM, Timothy Gu <timothygu99 at gmail.com> wrote:
> > On Jul 31, 2013 12:15 PM, "Michael Niedermayer" <michaelni at gmx.at> wrote:
> >>
> >> On Tue, Jul 30, 2013 at 07:42:32PM -0700, Timothy Gu wrote:
> >> > It is not possible to have a plugin[] array with 5 or more elements.
> >> > ---
> >> >
> >> > Changed according to newer versions of other patches
> >> >
> >> >  libavcodec/libxvid.c | 2 +-
> >> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >> >
> >> > diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
> >> > index edf5f43..8945c28 100644
> >> > --- a/libavcodec/libxvid.c
> >> > +++ b/libavcodec/libxvid.c
> >> > @@ -364,7 +364,7 @@ static av_cold int xvid_encode_init(AVCodecContext
> >> > *avctx)  {
> >> >      xvid_plugin_ssim_t        ssim            = { 0 };
> >> >      xvid_gbl_init_t           xvid_gbl_init   = { 0 };
> >> >      xvid_enc_create_t         xvid_enc_create = { 0 };
> >> > -    xvid_enc_plugin_t         plugins[7];
> >> > +    xvid_enc_plugin_t         plugins[4];
> >>
> >> the patch is correct but why should the array be tightened up ?
> >
> > For the sake of saving a few bytes in memory.
> >
> >> also it might make sense (independant of this patch) to check that
> >> the array is large enough for the used plugins
> >
> > I don't think there is a need for that. A developer can just count the value
> > of the counter by hand to make sure the array doesn't overload.
> 
> Will this be applied? (Read: ping)

without a check that ensures the array is large enough in the future,
i wont reduce the arrays size.
Doing otherwise would create fragile code that could easily become
a security issue

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130804/7db9cfdf/attachment.asc>


More information about the ffmpeg-devel mailing list