We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c5c06a5 commit 1e38870Copy full SHA for 1e38870
src/librustc_mir/interpret/machine.rs
@@ -211,10 +211,14 @@ pub trait Machine<'mir, 'tcx>: Sized {
211
) -> InterpResult<'tcx>;
212
213
fn int_to_ptr(
214
- _int: u64,
+ int: u64,
215
_extra: &Self::MemoryExtra,
216
) -> InterpResult<'tcx, Pointer<Self::PointerTag>> {
217
- Err(InterpErrorInfo::from(InterpError::ReadBytesAsPointer))
+ if int == 0 {
218
+ Err(InterpErrorInfo::from(InterpError::InvalidNullPointerUsage))
219
+ } else {
220
+ Err(InterpErrorInfo::from(InterpError::ReadBytesAsPointer))
221
+ }
222
}
223
224
fn ptr_to_int(
0 commit comments