Skip to content

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

Open
github-actions[bot] wants to merge 1 commit into
branch-4.0from
auto-pick-64828-branch-4.0
Open

branch-4.0: [fix](be) prevent SIGFPE in int_divide for signed min value #64828#64947
github-actions[bot] wants to merge 1 commit into
branch-4.0from
auto-pick-64828-branch-4.0

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-actions Bot requested a review from morningman as a code owner June 29, 2026 08:58
@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 Regression && UT Coverage Report

Increment line coverage 95.45% (21/22) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.58% (25595/35758)
Line Coverage 54.47% (271626/498637)
Region Coverage 52.12% (225548/432728)
Branch Coverage 53.51% (97027/181331)

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