Commit 340e3fa
Fix OP_CHECK_THIS to read 1 byte instead of 4/8 on x86/x64/LLVM. (#74762)
Current implementation of OP_CHECK_THIS on x86/x64 and LLVM does a
memory read of at least 4 bytes. This creates an issue when the
target is a managed pointer, since that could point to the interior
of a type, meaning it can read pass the allocated memory causing
a crash. Fix change the size of the read to one byte since the only
reason doing the read is to validate that the reference, managed pointer
is not NULL. Reading only one byte is also inline with how it is
implemented on arm/arm64, and it will reduce potential unaligned
reads on x86/x64.
Full fix for, #74179.
Co-authored-by: lateralusX <lateralusx.github@gmail.com>1 parent e56d52d commit 340e3fa
File tree
5 files changed
+12
-7
lines changed- src/mono/mono
- arch
- amd64
- x86
- mini
5 files changed
+12
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1206 | 1206 | | |
1207 | 1207 | | |
1208 | 1208 | | |
| 1209 | + | |
1209 | 1210 | | |
1210 | 1211 | | |
1211 | 1212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
682 | 682 | | |
683 | 683 | | |
684 | 684 | | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
685 | 692 | | |
686 | 693 | | |
687 | 694 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5511 | 5511 | | |
5512 | 5512 | | |
5513 | 5513 | | |
5514 | | - | |
| 5514 | + | |
5515 | 5515 | | |
5516 | 5516 | | |
5517 | 5517 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6856 | 6856 | | |
6857 | 6857 | | |
6858 | 6858 | | |
6859 | | - | |
| 6859 | + | |
6860 | 6860 | | |
6861 | 6861 | | |
6862 | 6862 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3192 | 3192 | | |
3193 | 3193 | | |
3194 | 3194 | | |
3195 | | - | |
3196 | | - | |
3197 | | - | |
3198 | | - | |
3199 | | - | |
| 3195 | + | |
| 3196 | + | |
3200 | 3197 | | |
3201 | 3198 | | |
3202 | 3199 | | |
| |||
0 commit comments