[FFmpeg-devel] [PATCH] avcodec/elsdec: Fix memleaks
Michael Niedermayer
michael at niedermayer.cc
Wed Apr 25 23:47:02 EEST 2018
On Tue, Apr 24, 2018 at 10:12:30PM -0300, James Almer wrote:
> On 4/24/2018 9:58 PM, Michael Niedermayer wrote:
> > Fixes: 6798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5135899701542912
> >
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> > libavcodec/elsdec.c | 10 ++++++----
> > libavcodec/g2meet.c | 1 +
> > 2 files changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/libavcodec/elsdec.c b/libavcodec/elsdec.c
> > index 4797965457..8327662b4b 100644
> > --- a/libavcodec/elsdec.c
> > +++ b/libavcodec/elsdec.c
> > @@ -271,7 +271,7 @@ void ff_els_decoder_init(ElsDecCtx *ctx, const uint8_t *in, size_t data_size)
> >
> > void ff_els_decoder_uninit(ElsUnsignedRung *rung)
> > {
> > - av_free(rung->rem_rung_list);
> > + av_freep(&rung->rem_rung_list);
> > }
> >
> > static int els_import_byte(ElsDecCtx *ctx)
> > @@ -389,16 +389,18 @@ unsigned ff_els_decode_unsigned(ElsDecCtx *ctx, ElsUnsignedRung *ur)
> > else {
> > if (!rung_node->next_index) {
> > if (ur->rung_list_size <= (ur->avail_index + 2) * sizeof(ElsRungNode)) {
> > + void *ptr_tmp;
> > // remember rung_node position
> > ptrdiff_t pos = rung_node - ur->rem_rung_list;
> > - ur->rem_rung_list = av_realloc(ur->rem_rung_list,
> > + ptr_tmp = av_realloc(ur->rem_rung_list,
> > ur->rung_list_size +
> > RUNG_SPACE);
>
> Use av_reallocp instead, to remove the tmp pointer and the av_freep call
> below.
will push with that change
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Elect your leaders based on what they did after the last election, not
based on what they say before an election.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180425/5abd9623/attachment.sig>
More information about the ffmpeg-devel
mailing list