Skip to content

Commit 2b5a843

Browse files
committed
fix potential overflow warnings
1 parent 4e7ac92 commit 2b5a843

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

utils/aplay/alsa-pcm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ int alsa_pcm_open(
177177

178178
/* Start the transfer when three requested periods have been written (or
179179
* when the buffer is full if it holds less than three requested periods. */
180-
snd_pcm_uframes_t start_threshold = (period_time * 3 / 1000) * (rate / 1000);
180+
snd_pcm_uframes_t start_threshold = ((snd_pcm_uframes_t)period_time * 3 / 1000) * (rate / 1000);
181181
if (start_threshold > buffer_size)
182182
start_threshold = buffer_size;
183183

utils/aplay/aplay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ static void *io_worker_routine(struct io_worker *w) {
471471
* This will be later be revised if necessary to match the actual ALSA
472472
* start threshold when the ALSA PCM is opened. */
473473
if (ffb_init(&read_buffer,
474-
(pcm_period_time * 3 / 1000) * (w->ba_pcm.rate * w->ba_pcm.channels / 1000),
474+
((size_t)pcm_period_time * 3 / 1000) * (w->ba_pcm.rate * w->ba_pcm.channels / 1000),
475475
pcm_format_size) == -1) {
476476
error("Couldn't create PCM buffer: %s", strerror(errno));
477477
goto fail;

0 commit comments

Comments
 (0)