fix heap buffer overflow in flac (#2030508)

Resolves: #2030508
This commit is contained in:
Michal Hlavinka 2022-01-12 09:59:09 +01:00
parent 054e68671b
commit 01bbfd3458
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From ced91d7b971be6173b604154c39279ce90ad87cc Mon Sep 17 00:00:00 2001
From: yuan <ssspeed00@gmail.com>
Date: Tue, 20 Apr 2021 16:16:32 +0800
Subject: [PATCH] flac: Fix improper buffer reusing (#732)
---
src/flac.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/flac.c b/src/flac.c
index 64d0172e6..e33204505 100644
--- a/src/flac.c
+++ b/src/flac.c
@@ -948,7 +948,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]) ;

View File

@ -1,7 +1,7 @@
Summary: Library for reading and writing sound files Summary: Library for reading and writing sound files
Name: libsndfile Name: libsndfile
Version: 1.0.31 Version: 1.0.31
Release: 6%{?dist} Release: 7%{?dist}
License: LGPLv2+ and GPLv2+ and BSD License: LGPLv2+ and GPLv2+ and BSD
URL: http://libsndfile.github.io/libsndfile/ URL: http://libsndfile.github.io/libsndfile/
Source0: https://github.com/libsndfile/libsndfile/releases/download/%{version}/libsndfile-%{version}.tar.bz2 Source0: https://github.com/libsndfile/libsndfile/releases/download/%{version}/libsndfile-%{version}.tar.bz2
@ -9,6 +9,8 @@ Patch0: libsndfile-1.0.25-system-gsm.patch
Patch1: libsndfile-1.0.25-zerodivfix.patch Patch1: libsndfile-1.0.25-zerodivfix.patch
# from upstream, for <= 1.0.31, rhbz#1985029 # from upstream, for <= 1.0.31, rhbz#1985029
Patch2: libsndfile-1.0.31-deb669ee.patch Patch2: libsndfile-1.0.31-deb669ee.patch
# from upstream, fix #2030508, for <= 1.0.31
Patch3: libsndfile-1.0.31-ced91d7b.patch
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: alsa-lib-devel BuildRequires: alsa-lib-devel
BuildRequires: flac-devel BuildRequires: flac-devel
@ -61,6 +63,7 @@ rm -r src/GSM610
# TODO: check if this patch is still needed # TODO: check if this patch is still needed
%patch1 -p1 -b .zerodivfix %patch1 -p1 -b .zerodivfix
%patch2 -p1 -b .deb669ee %patch2 -p1 -b .deb669ee
%patch3 -p1 -b .ced91d7b
%build %build
autoreconf -I M4 -fiv # for system-gsm patch autoreconf -I M4 -fiv # for system-gsm patch
@ -152,6 +155,9 @@ LD_LIBRARY_PATH=$PWD/src/.libs make check
%changelog %changelog
* Wed Jan 12 2022 Michal Hlavinka <mhlavink@redhat.com> - 1.0.31-7
- fix heap buffer overflow in flac (#2030508)
* Wed Aug 11 2021 Michal Hlavinka <mhlavink@redhat.com> - 1.0.31-6 * Wed Aug 11 2021 Michal Hlavinka <mhlavink@redhat.com> - 1.0.31-6
- a crafted wav file could cause heap buffer overflow that allowed an arbitrary code execution(#1985029) - a crafted wav file could cause heap buffer overflow that allowed an arbitrary code execution(#1985029)