From: Ralph Giles Date: Mon, 5 Jan 2015 18:04:20 +0000 (+0000) Subject: Fix encoder crash with non-positive sample rates. X-Git-Tag: v1.3.5~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8d5416c77e1aaa93b85a9e71d90531f9fb67aebc;p=platform%2Fupstream%2Flibvorbis.git Fix encoder crash with non-positive sample rates. Input files with sampling rate 0 are useless and can make libvorbis access invalid memory because the logic in _vp_psy_init (and probably other functions) isn't prepared for it. A sanity check lets the library refuse those inputs gracefully in the initialization functions before they can do harm. Patch by Martin Steghöfer Fixes #2078 Bug-Debian: https://bugs.debian.org/716613 svn path=/trunk/vorbis/; revision=19422 --- diff --git a/lib/vorbisenc.c b/lib/vorbisenc.c index 428d2aa..7e448cd 100644 --- a/lib/vorbisenc.c +++ b/lib/vorbisenc.c @@ -903,6 +903,8 @@ int vorbis_encode_setup_vbr(vorbis_info *vi, long channels, long rate, float quality){ + if(rate <= 0) return OV_EINVAL; + codec_setup_info *ci=vi->codec_setup; highlevel_encode_setup *hi=&ci->hi; @@ -948,6 +950,8 @@ int vorbis_encode_setup_managed(vorbis_info *vi, long nominal_bitrate, long min_bitrate){ + if(rate <= 0) return OV_EINVAL; + codec_setup_info *ci=vi->codec_setup; highlevel_encode_setup *hi=&ci->hi; double tnominal=nominal_bitrate;