Skip to content

branch-4.1: [fix](be) prevent SIGFPE in int_divide for signed min value #64828 - #64948

Merged
yiguolei merged 1 commit into
branch-4.1from
auto-pick-64828-branch-4.1
Jun 30, 2026
Merged

branch-4.1: [fix](be) prevent SIGFPE in int_divide for signed min value #64828#64948
yiguolei merged 1 commit into
branch-4.1from
auto-pick-64828-branch-4.1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Cherry-picked from #64828

### What problem does this PR solve?
`BIGINT_MIN DIV -1` can trigger signed integer overflow in BE
`int_divide` and terminate the backend with `SIGFPE`. Root cause:
`DivideIntegralImpl` only handled division by zero, but did not guard
the undefined signed case where the minimal signed integer is divided by
`-1`. This change follows the existing `mod`/`pmod` behavior and returns
`INVALID_ARGUMENT` before executing the unsafe division. The guard
covers const/const, vector/const, const/vector, and vector/vector paths.
https://godbolt.org/z/YPq9W581e
### Release note
None
@github-actions
github-actionsBot requested a review from yiguolei as a code ownerJune 29, 2026 08:59
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@hello-stephen

Copy link
Copy Markdown
Contributor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 95.45% (21/22) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage54.57% (20812/38141)
Line Coverage38.09% (198595/521424)
Region Coverage34.54% (155852/451159)
Branch Coverage35.52% (67992/191400)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 95.45% (21/22) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage64.24% (23934/37259)
Line Coverage47.77% (247853/518886)
Region Coverage45.16% (205137/454229)
Branch Coverage46.22% (88602/191685)

@yiguolei

Copy link
Copy Markdown
Contributor

skip buildall

@yiguolei
yiguolei merged commit 572bf13 into branch-4.1Jun 30, 2026
32 of 34 checks passed
@github-actions

Copy link
Copy Markdown
ContributorAuthor

PR approved by at least one committer and no changes requested.

@github-actionsgithub-actionsBot added approved Indicates a PR has been approved by one committer. reviewed labels Jun 30, 2026
@github-actions

Copy link
Copy Markdown
ContributorAuthor

PR approved by anyone and no changes requested.

@morningman
morningman deleted the auto-pick-64828-branch-4.1 branch July 8, 2026 14:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@hello-stephen@yiguolei@Mryange