@@ -785,7 +785,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
785
785
loop {
786
786
// FIXME: We are re-getting the allocation each time around the loop.
787
787
// 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
789
789
let byte = alloc. read_integer ( alloc_range ( Size :: ZERO , size1) ) ?. to_u8 ( ) ?;
790
790
if byte == 0 {
791
791
break ;
@@ -825,13 +825,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
825
825
fn read_wide_str ( & self , mut ptr : Pointer < Option < Provenance > > ) -> InterpResult < ' tcx , Vec < u16 > > {
826
826
let this = self . eval_context_ref ( ) ;
827
827
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 ( ) ) ? ;
829
829
830
830
let mut wchars = Vec :: new ( ) ;
831
831
loop {
832
832
// FIXME: We are re-getting the allocation each time around the loop.
833
833
// 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
835
835
let wchar = alloc. read_integer ( alloc_range ( Size :: ZERO , size2) ) ?. to_u16 ( ) ?;
836
836
if wchar == 0 {
837
837
break ;
@@ -867,8 +867,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
867
867
// Store the UTF-16 string.
868
868
let size2 = Size :: from_bytes ( 2 ) ;
869
869
let this = self . eval_context_mut ( ) ;
870
+ this. check_ptr_align ( ptr, Align :: from_bytes ( 2 ) . unwrap ( ) ) ?;
870
871
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) ?
872
873
. unwrap ( ) ; // not a ZST, so we will get a result
873
874
for ( offset, wchar) in wide_str. iter ( ) . copied ( ) . chain ( iter:: once ( 0x0000 ) ) . enumerate ( ) {
874
875
let offset = u64:: try_from ( offset) . unwrap ( ) ;
0 commit comments