diff --git a/libavformat/ogg2.c b/libavformat/ogg2.c index c54b2a04c537c38cc413bae262ddc41e169940d7..065d3bc0a668bc4b6023dfe6ce0d14cd531f2ec4 100644 --- a/libavformat/ogg2.c +++ b/libavformat/ogg2.c @@ -80,7 +80,7 @@ ogg_save (AVFormatContext * s) { ogg_t *ogg = s->priv_data; ogg_state_t *ost = - av_malloc(sizeof (*ost) + ogg->nstreams * sizeof (*ogg->streams)); + av_malloc(sizeof (*ost) + (ogg->nstreams-1) * sizeof (*ogg->streams)); int i; ost->pos = url_ftell (&s->pb);; ost->curidx = ogg->curidx; diff --git a/libavformat/ogg2.h b/libavformat/ogg2.h index b1146e314cd8cad4cba21695346ee4dbe75b1989..f397a57197ef49b4952f80f664e28fba1d3f3501 100644 --- a/libavformat/ogg2.h +++ b/libavformat/ogg2.h @@ -55,7 +55,7 @@ typedef struct ogg_state { uint64_t pos; int curidx; struct ogg_state *next; - ogg_stream_t streams[]; + ogg_stream_t streams[1]; } ogg_state_t; typedef struct ogg {