- CVE-2017-6892 - CVE-2017-8361 - CVE-2017-8362 - CVE-2017-8363 - CVE-2017-8365 - CVE-2017-12562 - CVE-2017-14634 Note: - Fix for CVE-2017-8365 is included in files/patch-CVE-2017-8361 While here: - Fix LICENSE and add LICENSE_FILE PR: 226271 Submitted by: jhale Reviewed by: koobs, eadler, jbeich Approved by: ports-secteam (eadler) Obtained from: upstream (https://github.com/erikd/libsndfile) MFH: 2018Q1 Security: 004debf9-1d16-11e8-b6aa-4ccc6adda413 Security: 2b386075-1d9c-11e8-b6aa-4ccc6adda413 Differential Revision: https://reviews.freebsd.org/D14552
53 lines
2.3 KiB
Text
53 lines
2.3 KiB
Text
From fd0484aba8e51d16af1e3a880f9b8b857b385eb3 Mon Sep 17 00:00:00 2001
|
|
From: Erik de Castro Lopo <erikd@mega-nerd.com>
|
|
Date: Wed, 12 Apr 2017 19:45:30 +1000
|
|
Subject: [PATCH] FLAC: Fix a buffer read overrun
|
|
|
|
Buffer read overrun occurs when reading a FLAC file that switches
|
|
from 2 channels to one channel mid-stream. Only option is to
|
|
abort the read.
|
|
|
|
Closes: https://github.com/erikd/libsndfile/issues/230
|
|
Addresses: CVE-2017-8361 CVE-2017-8363 CVE-2017-8365
|
|
--- src/common.h.orig 2017-04-01 09:40:45 UTC
|
|
+++ src/common.h
|
|
@@ -725,6 +725,7 @@ enum
|
|
SFE_FLAC_INIT_DECODER,
|
|
SFE_FLAC_LOST_SYNC,
|
|
SFE_FLAC_BAD_SAMPLE_RATE,
|
|
+ SFE_FLAC_CHANNEL_COUNT_CHANGED,
|
|
SFE_FLAC_UNKOWN_ERROR,
|
|
|
|
SFE_WVE_NOT_WVE,
|
|
--- src/flac.c.orig 2018-03-01 19:51:26 UTC
|
|
+++ src/flac.c
|
|
@@ -434,6 +434,19 @@ sf_flac_meta_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC_
|
|
|
|
switch (metadata->type)
|
|
{ case FLAC__METADATA_TYPE_STREAMINFO :
|
|
+ if (psf->sf.channels > 0 && psf->sf.channels != (int) metadata->data.stream_info.channels)
|
|
+ { psf_log_printf (psf, "Error: FLAC stream changed from %d to %d channels\n"
|
|
+ "Nothing to be but to error out.\n" ,
|
|
+ psf->sf.channels, metadata->data.stream_info.channels) ;
|
|
+ psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ;
|
|
+ return ;
|
|
+ } ;
|
|
+
|
|
+ if (psf->sf.channels > 0 && psf->sf.samplerate != (int) metadata->data.stream_info.sample_rate)
|
|
+ { psf_log_printf (psf, "Warning: FLAC stream changed sample rates from %d to %d.\n"
|
|
+ "Carrying on as if nothing happened.",
|
|
+ psf->sf.samplerate, metadata->data.stream_info.sample_rate) ;
|
|
+ } ;
|
|
psf->sf.channels = metadata->data.stream_info.channels ;
|
|
psf->sf.samplerate = metadata->data.stream_info.sample_rate ;
|
|
psf->sf.frames = metadata->data.stream_info.total_samples ;
|
|
--- src/sndfile.c.orig 2017-04-02 06:33:16 UTC
|
|
+++ src/sndfile.c
|
|
@@ -245,6 +245,7 @@ ErrorStruct SndfileErrors [] =
|
|
{ SFE_FLAC_INIT_DECODER , "Error : problem with initialization of the flac decoder." },
|
|
{ SFE_FLAC_LOST_SYNC , "Error : flac decoder lost sync." },
|
|
{ SFE_FLAC_BAD_SAMPLE_RATE, "Error : flac does not support this sample rate." },
|
|
+ { SFE_FLAC_CHANNEL_COUNT_CHANGED, "Error : flac channel changed mid stream." },
|
|
{ SFE_FLAC_UNKOWN_ERROR , "Error : unknown error in flac decoder." },
|
|
|
|
{ SFE_WVE_NOT_WVE , "Error : not a WVE file." },
|