Skip to content

[PR] Adding CONTINUE strategy impl to DivByZero sanitizer - #248

Merged
rjsmith1999 merged 13 commits into
mainfrom
adding-continue-to-div-by-zero
Aug 25, 2026
Merged

[PR] Adding CONTINUE strategy impl to DivByZero sanitizer#248
rjsmith1999 merged 13 commits into
mainfrom
adding-continue-to-div-by-zero

Conversation

@elazaro-riverside

@elazaro-riverside elazaro-riverside commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

This PR contains a change to the ArithmeticSanitizer.cpp source file. The divide by zero sanitizer did not have an implementation for the CONTINUE remediation strategy. This PR attempts to fix this by creating a helper function to generate the correct INT_MAX constant value for the operand type.

Something to note is that the compiler-generated remediation strategies (EXIT, RECOVER, CONTINUE) have different control-flow behavior. RECOVER and EXIT transfer control to other processes thereby not resuming program execution. CONTINUE generates a constant and resumes program execution. At the IR level, we want to insert an unreachable instruction if the selected strategy is EXIT or RECOVER. Otherwise, we want to merge the constant value generated from the continue strategy back into the basic block to continue execution.
To handle these cases, I modified the CFG-mutation logic to generate the correct control flow behavior based on the selected strategy.

@elazaro-riverside elazaro-riverside self-assigned this Aug 7, 2026
@elazaro-riverside elazaro-riverside added the CVEAssert Related to CVEAssert component label Aug 7, 2026
@elazaro-riverside
elazaro-riverside marked this pull request as ready for review August 7, 2026 14:13
Comment thread resolve-cveassert/src/ArithmeticSanitizer.cpp Outdated
@elazaro-riverside
elazaro-riverside force-pushed the adding-continue-to-div-by-zero branch from ef6d233 to 7e7ee24 Compare August 20, 2026 21:11
}
}

if (Ty->isFloatTy()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you want "isFloatingPointTy" not isFloatTy here

Ethan Lazaro added 2 commits August 25, 2026 10:29
…ered incompatible with this sanitizer. This also quiets clang-tidy complaint.
@rjsmith1999
rjsmith1999 merged commit e5140c4 into main Aug 25, 2026
1 check failed
@rjsmith1999
rjsmith1999 deleted the adding-continue-to-div-by-zero branch August 25, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CVEAssert Related to CVEAssert component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants