Skip to content

butil: fix undefined behaviors#3135

Merged
chenBright merged 1 commit into
apache:masterfrom
BusyJay:fix-undefined
Dec 7, 2025
Merged

butil: fix undefined behaviors#3135
chenBright merged 1 commit into
apache:masterfrom
BusyJay:fix-undefined

Conversation

@BusyJay

@BusyJay BusyJay commented Oct 31, 2025

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: resolve #3134

Problem Summary:

There are two kinds of problems:

  1. signed number overflow is undefined behavior;
  2. vsnprintfT may return E2BIG instead of EOVERFLOW.

What is changed and the side effects?

Changed:

Side effects:

  • Performance effects:

  • Breaking backward compatibility:


Check List:

@BusyJay BusyJay changed the title butil: fix unit test when build with clang-15 butil: fix undefined behaviors Oct 31, 2025
There are two kinds of problems:
1. signed number overflow is undefined behavior;
2. vsnprintfT may return E2BIG instead of EOVERFLOW.

@chenBright chenBright left a comment

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.

LGTM

@chenBright chenBright merged commit f58ec39 into apache:master Dec 7, 2025
17 checks passed
@BusyJay BusyJay deleted the fix-undefined branch December 8, 2025 03:41
zchuango pushed a commit to zchuango/brpc that referenced this pull request May 9, 2026
There are two kinds of problems:
1. signed number overflow is undefined behavior;
2. vsnprintfT may return E2BIG instead of EOVERFLOW.
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.

test_butil fail when compiling using clang-15

2 participants