Skip to content

opensl: Protect against stm->written overflow with long streams.#839

Merged
kinetiknz merged 1 commit into
masterfrom
opensl_oflow
Mar 24, 2026
Merged

opensl: Protect against stm->written overflow with long streams.#839
kinetiknz merged 1 commit into
masterfrom
opensl_oflow

Conversation

@kinetiknz
Copy link
Copy Markdown
Collaborator

Also move the assert inside the mutex to avoid racing with the callback thread.

@kinetiknz kinetiknz requested review from Pehrsons and padenot March 23, 2026 08:34
@kinetiknz kinetiknz self-assigned this Mar 23, 2026
Also move the assert inside the mutex to avoid racing with the callback
thread.
Comment thread src/cubeb_opensl.cpp
Comment on lines +1863 to +1864
int64_t maximum_position =
stm->written * stm->user_output_rate / stm->output_configured_rate;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By my calculation for a high rate (384kHz) stm->written * stm->user_output_rate will overflow after 723 days. At 768kHz I get 180 days. Should be ok.

@kinetiknz kinetiknz merged commit 65e80cf into master Mar 24, 2026
45 of 46 checks passed
@kinetiknz kinetiknz deleted the opensl_oflow branch March 24, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants