@@ -785,7 +785,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
785785 loop {
786786 // FIXME: We are re-getting the allocation each time around the loop.
787787 // Would be nice if we could somehow "extend" an existing AllocRange.
788- let alloc = this. get_ptr_alloc ( ptr. offset ( len, this) ?, size1, Align :: ONE ) ?. unwrap ( ) ; // not a ZST, so we will get a result
788+ let alloc = this. get_ptr_alloc ( ptr. offset ( len, this) ?, size1) ?. unwrap ( ) ; // not a ZST, so we will get a result
789789 let byte = alloc. read_integer ( alloc_range ( Size :: ZERO , size1) ) ?. to_u8 ( ) ?;
790790 if byte == 0 {
791791 break ;
@@ -825,13 +825,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
825825 fn read_wide_str ( & self , mut ptr : Pointer < Option < Provenance > > ) -> InterpResult < ' tcx , Vec < u16 > > {
826826 let this = self . eval_context_ref ( ) ;
827827 let size2 = Size :: from_bytes ( 2 ) ;
828- let align2 = Align :: from_bytes ( 2 ) . unwrap ( ) ;
828+ this . check_ptr_align ( ptr , Align :: from_bytes ( 2 ) . unwrap ( ) ) ? ;
829829
830830 let mut wchars = Vec :: new ( ) ;
831831 loop {
832832 // FIXME: We are re-getting the allocation each time around the loop.
833833 // Would be nice if we could somehow "extend" an existing AllocRange.
834- let alloc = this. get_ptr_alloc ( ptr, size2, align2 ) ?. unwrap ( ) ; // not a ZST, so we will get a result
834+ let alloc = this. get_ptr_alloc ( ptr, size2) ?. unwrap ( ) ; // not a ZST, so we will get a result
835835 let wchar = alloc. read_integer ( alloc_range ( Size :: ZERO , size2) ) ?. to_u16 ( ) ?;
836836 if wchar == 0 {
837837 break ;
@@ -867,8 +867,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
867867 // Store the UTF-16 string.
868868 let size2 = Size :: from_bytes ( 2 ) ;
869869 let this = self . eval_context_mut ( ) ;
870+ this. check_ptr_align ( ptr, Align :: from_bytes ( 2 ) . unwrap ( ) ) ?;
870871 let mut alloc = this
871- . get_ptr_alloc_mut ( ptr, size2 * string_length, Align :: from_bytes ( 2 ) . unwrap ( ) ) ?
872+ . get_ptr_alloc_mut ( ptr, size2 * string_length) ?
872873 . unwrap ( ) ; // not a ZST, so we will get a result
873874 for ( offset, wchar) in wide_str. iter ( ) . copied ( ) . chain ( iter:: once ( 0x0000 ) ) . enumerate ( ) {
874875 let offset = u64:: try_from ( offset) . unwrap ( ) ;
0 commit comments