Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP6
pipewire.30992
0001-alsa-guard-against-some-invalid-values.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-alsa-guard-against-some-invalid-values.patch of Package pipewire.30992
From 32a7c85c84e419636109eb5db127292e25462a38 Mon Sep 17 00:00:00 2001 From: Wim Taymans <wtaymans@redhat.com> Date: Mon, 16 Jan 2023 16:05:17 +0100 Subject: [PATCH] alsa: guard against some invalid values Avoid division by 0 and other strange things when invalid values are detected. Fixes #2953 --- spa/plugins/alsa/alsa-pcm.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index 76fe433b8..08b9ceddd 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -1519,6 +1519,11 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_ fmt->info.raw.rate = rrate; match = false; } + if (rchannels == 0 || rrate == 0) { + spa_log_error(state->log, "%s: invalid channels:%d or rate:%d", + state->props.device, rchannels, rrate); + return -EIO; + } state->format = rformat; state->channels = rchannels; @@ -1563,6 +1568,11 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_ CHECK(snd_pcm_hw_params_set_period_size_near(hndl, params, &period_size, &dir), "set_period_size_near"); + if (period_size == 0) { + spa_log_error(state->log, "%s: invalid period_size 0 (driver error?)", state->props.device); + return -EIO; + } + state->period_frames = period_size; if (state->default_period_num != 0) { @@ -1578,6 +1588,10 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_ CHECK(snd_pcm_hw_params_set_buffer_size_near(hndl, params, &state->buffer_frames), "set_buffer_size_near"); periods = state->buffer_frames / period_size; } + if (state->buffer_frames == 0) { + spa_log_error(state->log, "%s: invalid buffer_frames 0 (driver error?)", state->props.device); + return -EIO; + } state->headroom = state->default_headroom; if (is_batch) @@ -2542,6 +2556,14 @@ int spa_alsa_start(struct state *state) state->duration = 1024; state->rate_denom = state->rate; } + if (state->rate_denom == 0) { + spa_log_error(state->log, "%s: unset rate_denom", state->props.device); + return -EIO; + } + if (state->duration == 0) { + spa_log_error(state->log, "%s: unset duration", state->props.device); + return -EIO; + } state->following = is_following(state); setup_matching(state); -- GitLab
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor