gnu: kio: Search 'smbd' on $PATH.
[jackhill/guix/guix.git] / gnu / packages / patches / libsndfile-CVE-2017-8361-8363-8365.patch
1 Fix CVE-2017-{8361,8363,8365}:
2
3 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8361
4 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8363
5 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8365
6
7 Patch copied from upstream source repository:
8
9 https://github.com/erikd/libsndfile/commit/fd0484aba8e51d16af1e3a880f9b8b857b385eb3
10
11 From fd0484aba8e51d16af1e3a880f9b8b857b385eb3 Mon Sep 17 00:00:00 2001
12 From: Erik de Castro Lopo <erikd@mega-nerd.com>
13 Date: Wed, 12 Apr 2017 19:45:30 +1000
14 Subject: [PATCH] FLAC: Fix a buffer read overrun
15
16 Buffer read overrun occurs when reading a FLAC file that switches
17 from 2 channels to one channel mid-stream. Only option is to
18 abort the read.
19
20 Closes: https://github.com/erikd/libsndfile/issues/230
21 ---
22 src/common.h | 1 +
23 src/flac.c | 13 +++++++++++++
24 src/sndfile.c | 1 +
25 3 files changed, 15 insertions(+)
26
27 diff --git a/src/common.h b/src/common.h
28 index 0bd810c3..e2669b6a 100644
29 --- a/src/common.h
30 +++ b/src/common.h
31 @@ -725,6 +725,7 @@ enum
32 SFE_FLAC_INIT_DECODER,
33 SFE_FLAC_LOST_SYNC,
34 SFE_FLAC_BAD_SAMPLE_RATE,
35 + SFE_FLAC_CHANNEL_COUNT_CHANGED,
36 SFE_FLAC_UNKOWN_ERROR,
37
38 SFE_WVE_NOT_WVE,
39 diff --git a/src/flac.c b/src/flac.c
40 index 84de0e26..986a7b8f 100644
41 --- a/src/flac.c
42 +++ b/src/flac.c
43 @@ -434,6 +434,19 @@ sf_flac_meta_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC_
44
45 switch (metadata->type)
46 { case FLAC__METADATA_TYPE_STREAMINFO :
47 + if (psf->sf.channels > 0 && psf->sf.channels != (int) metadata->data.stream_info.channels)
48 + { psf_log_printf (psf, "Error: FLAC stream changed from %d to %d channels\n"
49 + "Nothing to be but to error out.\n" ,
50 + psf->sf.channels, metadata->data.stream_info.channels) ;
51 + psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ;
52 + return ;
53 + } ;
54 +
55 + if (psf->sf.channels > 0 && psf->sf.samplerate != (int) metadata->data.stream_info.sample_rate)
56 + { psf_log_printf (psf, "Warning: FLAC stream changed sample rates from %d to %d.\n"
57 + "Carrying on as if nothing happened.",
58 + psf->sf.samplerate, metadata->data.stream_info.sample_rate) ;
59 + } ;
60 psf->sf.channels = metadata->data.stream_info.channels ;
61 psf->sf.samplerate = metadata->data.stream_info.sample_rate ;
62 psf->sf.frames = metadata->data.stream_info.total_samples ;
63 diff --git a/src/sndfile.c b/src/sndfile.c
64 index 41875610..e2a87be8 100644
65 --- a/src/sndfile.c
66 +++ b/src/sndfile.c
67 @@ -245,6 +245,7 @@ ErrorStruct SndfileErrors [] =
68 { SFE_FLAC_INIT_DECODER , "Error : problem with initialization of the flac decoder." },
69 { SFE_FLAC_LOST_SYNC , "Error : flac decoder lost sync." },
70 { SFE_FLAC_BAD_SAMPLE_RATE, "Error : flac does not support this sample rate." },
71 + { SFE_FLAC_CHANNEL_COUNT_CHANGED, "Error : flac channel changed mid stream." },
72 { SFE_FLAC_UNKOWN_ERROR , "Error : unknown error in flac decoder." },
73
74 { SFE_WVE_NOT_WVE , "Error : not a WVE file." },
75 --
76 2.12.2
77