qi: Fix 'rootdir' value, include post-install from proper location
[dragora.git] / patches / vorbis-tools / 0006-Add-sampling-rate-sanity-check-to-avoid-crash.patch
blobb135160dc0bbe9da3e1c6e8465bd8db11d580069
1 From: =?utf-8?q?Martin_Stegh=C3=B6fer?= <martin@steghoefer.eu>
2 Date: Mon, 27 Oct 2014 19:51:13 +0100
3 Subject: Add sampling rate sanity check to avoid crash.
5 Bug-Debian: https://bugs.debian.org/716613
6 Forwarded: https://trac.xiph.org/ticket/2078
8 Input files with sampling rate 0 are useless and can make oggenc crash because neither oggenc itself nor libvorbis are prepared for this case. A sanity check lets the program refuse those inputs gracefully without crash.
9 ---
10 oggenc/oggenc.c | 9 +++++++++
11 1 file changed, 9 insertions(+)
13 diff --git a/oggenc/oggenc.c b/oggenc/oggenc.c
14 index 5c36fea..6a6d8fe 100644
15 --- a/oggenc/oggenc.c
16 +++ b/oggenc/oggenc.c
17 @@ -272,6 +272,15 @@ int main(int argc, char **argv)
18 errors++;
19 continue;
22 + if(enc_opts.rate <= 0)
23 + {
24 + fprintf(stderr, _("ERROR: Input file \"%s\" has invalid sampling rate\n"), infiles[i]?infiles[i]:"(stdin)");
25 + if(closein)
26 + fclose(in);
27 + errors++;
28 + continue;
29 + }
31 /* Ok. We can read the file - so now open the output file */