123456789101112131415161718192021222324252627282930313233 |
- From: =?utf-8?q?Martin_Stegh=C3=B6fer?= <martin@steghoefer.eu>
- Date: Mon, 27 Oct 2014 19:51:13 +0100
- Subject: Add sampling rate sanity check to avoid crash.
- Bug-Debian: https://bugs.debian.org/716613
- Forwarded: https://trac.xiph.org/ticket/2078
- 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.
- ---
- oggenc/oggenc.c | 9 +++++++++
- 1 file changed, 9 insertions(+)
- diff --git a/oggenc/oggenc.c b/oggenc/oggenc.c
- index 5c36fea..6a6d8fe 100644
- --- a/oggenc/oggenc.c
- +++ b/oggenc/oggenc.c
- @@ -272,6 +272,15 @@ int main(int argc, char **argv)
- errors++;
- continue;
- }
- +
- + if(enc_opts.rate <= 0)
- + {
- + fprintf(stderr, _("ERROR: Input file \"%s\" has invalid sampling rate\n"), infiles[i]?infiles[i]:"(stdin)");
- + if(closein)
- + fclose(in);
- + errors++;
- + continue;
- + }
-
- /* Ok. We can read the file - so now open the output file */
-
|