Brad Bishop | 220d553 | 2018-08-14 00:59:39 +0100 | [diff] [blame] | 1 | From 4f47b63e9c971e6391590caf00a0f2a5ed612e67 Mon Sep 17 00:00:00 2001 |
| 2 | From: Erik de Castro Lopo <erikd@mega-nerd.com> |
| 3 | Date: Sat, 8 Apr 2017 18:34:49 +1000 |
| 4 | Subject: [PATCH] stream_decoder.c: Fix a memory leak |
| 5 | |
| 6 | Leak reported by Secunia Research. |
| 7 | CVE: CVE-2017-6888 |
| 8 | Upstream-Status: Backport [https://git.xiph.org/?p=flac.git;a=commitdiff;h=4f47b63e9c971e6391590caf00a0f2a5ed612e67] |
| 9 | |
| 10 | Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com> |
| 11 | --- |
| 12 | src/libFLAC/stream_decoder.c | 3 +++ |
| 13 | 1 file changed, 3 insertions(+) |
| 14 | |
| 15 | diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c |
| 16 | index 14d5fe7f..a5527511 100644 |
| 17 | --- a/src/libFLAC/stream_decoder.c |
| 18 | +++ b/src/libFLAC/stream_decoder.c |
| 19 | @@ -1753,6 +1753,9 @@ FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__Stre |
| 20 | } |
| 21 | memset (obj->comments[i].entry, 0, obj->comments[i].length) ; |
| 22 | if (!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->comments[i].entry, obj->comments[i].length)) { |
| 23 | + /* Current i-th entry is bad, so we delete it. */ |
| 24 | + free (obj->comments[i].entry) ; |
| 25 | + obj->comments[i].entry = NULL ; |
| 26 | obj->num_comments = i; |
| 27 | goto skip; |
| 28 | } |
| 29 | -- |
| 30 | 2.13.3 |
| 31 | |