Skip to content

Avoid UB in Text::findBestTextSize if std::lower_bound returns cbegin() - #386

Merged
texus merged 1 commit into
texus:1.xfrom
jjuhl:1.x
Jul 19, 2026
Merged

Avoid UB in Text::findBestTextSize if std::lower_bound returns cbegin()#386
texus merged 1 commit into
texus:1.xfrom
jjuhl:1.x

Conversation

@jjuhl

@jjuhl jjuhl commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

If std::lower_bound returns the first element then we'll run into UB when we later do
const auto low = high - 1;
avoid that by returning *high in that case.

If std::lower_bound returns the first element then we'll run into UB when we later do
  const auto low = high - 1;
avoid that by returning *high in that case.
@texus
texus merged commit 6b7a914 into texus:1.x Jul 19, 2026
31 of 32 checks passed
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