summaryrefslogtreecommitdiffstats
path: root/meta/recipes-multimedia/libsndfile/libsndfile1/CVE-2021-4156.patch
blob: b0ff1a088579e9ff692f3399f08c2ad45c37b038 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From 5adbc377cd90aa40f0cd56ae325ca70065a8aa19 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Thu, 13 Jan 2022 16:45:59 +0800
Subject: [PATCH] flac: Fix improper buffer reusing

CVE: CVE-2021-4156.patch
Upstream-Status: Backport [https://github.com/libsndfile/libsndfile/issues/731]

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 src/flac.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/flac.c b/src/flac.c
index 0be82ac..6548bba 100644
--- a/src/flac.c
+++ b/src/flac.c
@@ -952,7 +952,11 @@ flac_read_loop (SF_PRIVATE *psf, unsigned len)
 	/* Decode some more. */
 	while (pflac->pos < pflac->len)
 	{	if (FLAC__stream_decoder_process_single (pflac->fsd) == 0)
+		{	psf_log_printf (psf, "FLAC__stream_decoder_process_single returned false\n") ;
+			/* Current frame is busted, so NULL the pointer. */
+			pflac->frame = NULL ;
 			break ;
+                }
 		state = FLAC__stream_decoder_get_state (pflac->fsd) ;
 		if (state >= FLAC__STREAM_DECODER_END_OF_STREAM)
 		{	psf_log_printf (psf, "FLAC__stream_decoder_get_state returned %s\n", FLAC__StreamDecoderStateString [state]) ;
-- 
2.17.1