From: Xuemin Su xuemin.su@intel.com
In compress_get_hpointer, check for invalid sample rate to prevent devide-by-zero exceptions
Signed-off-by: Xuemin Su xuemin.su@intel.com Signed-off-by: He Bo bo.he@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- compress.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/compress.c b/compress.c index b035e4a..27c03d9 100644 --- a/compress.c +++ b/compress.c @@ -286,6 +286,8 @@ int compress_get_hpointer(struct compress *compress,
if (ioctl(compress->fd, SNDRV_COMPRESS_AVAIL, &kavail)) return oops(compress, errno, "cannot get avail"); + if (0 == kavail.tstamp.sampling_rate) + return oops(compress, errno, "invalid paramter"); *avail = (unsigned int)kavail.avail; time = kavail.tstamp.pcm_io_frames / kavail.tstamp.sampling_rate; tstamp->tv_sec = time;