45 lines
1.4 KiB
Diff
45 lines
1.4 KiB
Diff
|
Description: fixing another memory leak in FLAC code
|
||
|
CVE-2017-8363
|
||
|
Author: Erik de Castro Lopo
|
||
|
Origin: upstream
|
||
|
Applied-Upstream: https://github.com/erikd/libsndfile/commit/cd7da8dbf6ee4310d21d9e44b385d6797160d9e8 & https://github.com/erikd/libsndfile/commit/5206a9b65e61598fde44d276c81b0585bc428562
|
||
|
Last-Update: 2017-05-28
|
||
|
---
|
||
|
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
|
||
|
--- libsndfile.orig/src/flac.c
|
||
|
+++ libsndfile/src/flac.c
|
||
|
@@ -430,8 +430,7 @@
|
||
|
static void
|
||
|
sf_flac_meta_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC__StreamMetadata *metadata, void *client_data)
|
||
|
{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ;
|
||
|
- FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ;
|
||
|
- int bitwidth = 0, i ;
|
||
|
+ int bitwidth = 0 ;
|
||
|
|
||
|
switch (metadata->type)
|
||
|
{ case FLAC__METADATA_TYPE_STREAMINFO :
|
||
|
@@ -481,12 +480,6 @@
|
||
|
|
||
|
if (bitwidth > 0)
|
||
|
psf_log_printf (psf, " Bit width : %d\n", bitwidth) ;
|
||
|
-
|
||
|
-
|
||
|
- for (i = 0 ; i < psf->sf.channels ; i++)
|
||
|
- pflac->rbuffer [i] = calloc (FLAC__MAX_BLOCK_SIZE, sizeof (int32_t)) ;
|
||
|
-
|
||
|
- pflac->wbuffer = (const int32_t* const*) pflac->rbuffer ;
|
||
|
break ;
|
||
|
|
||
|
case FLAC__METADATA_TYPE_VORBIS_COMMENT :
|
||
|
@@ -848,7 +841,9 @@
|
||
|
|
||
|
psf_log_printf (psf, "End\n") ;
|
||
|
|
||
|
- if (psf->error == 0)
|
||
|
+ if (psf->error != 0)
|
||
|
+ FLAC__stream_decoder_delete (pflac->fsd) ;
|
||
|
+ else
|
||
|
{ FLAC__uint64 position ;
|
||
|
|
||
|
FLAC__stream_decoder_get_decode_position (pflac->fsd, &position) ;
|