From 80085d470d189362ddb6dda9bba6ee05fe7c84c6 Mon Sep 17 00:00:00 2001 From: "Gabriel M. Beddingfield" Date: Wed, 8 Feb 2012 16:53:32 -0600 Subject: pcm: Fix integer size error. The following code: while (pcm->boundary * 2 <= LONG_MAX - pcm->buffer_size) pcm->boundary *= 2; Creates an infinite loop on systems where LONG_MAX != INT_MAX (e.g. 64-bit systems). pcm->boundary is an unsigned int, and so INT_MAX is the proper value to use. --- pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pcm.c b/pcm.c index 2ef7075..fe2a8d6 100644 --- a/pcm.c +++ b/pcm.c @@ -558,7 +558,7 @@ struct pcm *pcm_open(unsigned int card, unsigned int device, sparams.silence_threshold = config->silence_threshold; pcm->boundary = sparams.boundary = pcm->buffer_size; - while (pcm->boundary * 2 <= LONG_MAX - pcm->buffer_size) + while (pcm->boundary * 2 <= INT_MAX - pcm->buffer_size) pcm->boundary *= 2; if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_SW_PARAMS, &sparams)) { -- cgit v1.2.3