-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
guardable UB: flag mem access of poison/undef ptrs
- Loading branch information
1 parent
2e57d13
commit 4bd483b
Showing
4 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
tests/alive-tv/non-ub-exploitation/nonnull_metadata.srctgt.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
; TEST-ARGS: -disallow-ub-exploitation | ||
; SKIP-IDENTITY | ||
|
||
define i1 @src(ptr %x) { | ||
%y = load ptr, ptr %x, !nonnull !1 | ||
%c = icmp eq ptr %y, null | ||
ret i1 %c | ||
} | ||
|
||
define i1 @tgt(ptr %x) { | ||
ret i1 false | ||
} | ||
|
||
!1 = !{} | ||
|
||
; ERROR: Source has guardable UB |
16 changes: 16 additions & 0 deletions
16
tests/alive-tv/non-ub-exploitation/range_metadata.srctgt.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
; TEST-ARGS: -disallow-ub-exploitation | ||
; SKIP-IDENTITY | ||
|
||
define i1 @src(ptr %x) { | ||
%y = load i8, ptr %x, !range !1 | ||
%c = icmp eq i8 %y, 9 | ||
ret i1 %c | ||
} | ||
|
||
define i1 @tgt(ptr %x) { | ||
ret i1 false | ||
} | ||
|
||
!1 = !{i8 0, i8 5} | ||
|
||
; ERROR: Source returns poison |