openbsd-ports/audio/libsndfile/patches/patch-src_htk_c
2009-05-31 17:31:13 +00:00

28 lines
1.0 KiB
Plaintext

$OpenBSD: patch-src_htk_c,v 1.1 2009/05/31 17:31:13 jasper Exp $
Security fix for SA35266.
--- src/htk.c.orig Sun Mar 22 13:17:14 2009
+++ src/htk.c Sun May 31 10:21:16 2009
@@ -195,10 +195,17 @@ htk_read_header (SF_PRIVATE *psf)
return SFE_HTK_NOT_WAVEFORM ;
psf->sf.channels = 1 ;
- psf->sf.samplerate = 10000000 / sample_period ;
- psf_log_printf (psf, "HTK Waveform file\n Sample Count : %d\n Sample Period : %d => %d Hz\n",
- sample_count, sample_period, psf->sf.samplerate) ;
+ if (sample_period > 0)
+ { psf->sf.samplerate = 10000000 / sample_period ;
+ psf_log_printf (psf, "HTK Waveform file\n Sample Count : %d\n Sample Period : %d => %d Hz\n",
+ sample_count, sample_period, psf->sf.samplerate) ;
+ }
+ else
+ { psf->sf.samplerate = 16000 ;
+ psf_log_printf (psf, "HTK Waveform file\n Sample Count : %d\n Sample Period : %d (should be > 0) => Guessed sample rate %d Hz\n",
+ sample_count, sample_period, psf->sf.samplerate) ;
+ } ;
psf->sf.format = SF_FORMAT_HTK | SF_FORMAT_PCM_16 ;
psf->bytewidth = 2 ;