Integer overflow in negation in ratpowi32()
Author: divVerentCreated Sep 16, 2026Updated Sep 16, 2026
Describe the bug Some integer a^b operations can crash calc due to exhaustion of stack space.
Steps To Reproduce
- Launch calc
- Switch to scientific mode
- Type in:
(-1)^(-2^31)=
Expected behavior
Output should be 1.
Device and Application Information
- OS Build: 10.0.26100.0
- Architecture: X64
- Application Version: 11.2607.0.0
- Region: en-US
- Dev Version Installed: False
Additional context
Event log excerpt:
Faulting application name: CalculatorApp.exe, version: 11.2607.0.0, time stamp: 0x6a736ec2
Faulting module name: SharedLibrary.dll, version: 2.2.29512.0, time stamp: 0x5fad1a6e
Exception code: 0x00001007
Fault offset: 0x00000000007e38deBug is here:
When power is INT_MIN, negating it results in INT_MIN again, thus still negative, recursing endlessly.
Requested Assignment I'm just reporting this problem. I don't want to fix it.
Source: microsoft/calculator