[FFmpeg-devel] [PATCH] dcaenc: fix segfault when attempting to encode with invalid samplerate
Michael Niedermayer
michael at niedermayer.cc
Sun May 6 03:27:35 EEST 2018
On Sat, May 05, 2018 at 06:43:34PM +0100, Rostislav Pehlivanov wrote:
> ---
> libavcodec/dcaenc.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
> index 186997c631..4b4ceeff05 100644
> --- a/libavcodec/dcaenc.c
> +++ b/libavcodec/dcaenc.c
> @@ -152,8 +152,11 @@ static int subband_bufer_alloc(DCAEncContext *c)
>
> static void subband_bufer_free(DCAEncContext *c)
> {
> - int32_t *bufer = c->subband[0][0] - DCA_ADPCM_COEFFS;
> - av_freep(&bufer);
> + if (c->subband[0][0]) {
> + int32_t *bufer = c->subband[0][0] - DCA_ADPCM_COEFFS;
> + av_free(bufer);
> + c->subband[0][0] = NULL;
> + }
LGTM but adding a seperate field representing the allocated array
that isnt offset could be clearer and more robust.
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- 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/20180506/4deb772d/attachment.sig>
More information about the ffmpeg-devel
mailing list