File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -1060,7 +1060,8 @@ impl<T: ?Sized> *const T {
10601060 // Else if count is not zero, then ensure that adding `count` doesn't cause
10611061 // overflow and that both pointers `self` and the result are in the same
10621062 // allocation
1063- ( ( self . addr( ) as isize ) . checked_add( count as isize ) . is_some( ) &&
1063+ ( count <= isize :: MAX as usize &&
1064+ ( self . addr( ) as isize ) . checked_add( count as isize ) . is_some( ) &&
10641065 core:: ub_checks:: same_allocation( self , self . wrapping_byte_add( count) ) )
10651066 ) ]
10661067 #[ ensures( |& result|
@@ -1203,7 +1204,7 @@ impl<T: ?Sized> *const T {
12031204 // Else if count is not zero, then ensure that subtracting `count` doesn't
12041205 // cause overflow and that both pointers `self` and the result are in the
12051206 // same allocation
1206- ( ( self . addr( ) as isize ) . checked_sub( count as isize ) . is_some( ) &&
1207+ ( count <= isize :: MAX as usize && ( self . addr( ) as isize ) . checked_sub( count as isize ) . is_some( ) &&
12071208 core:: ub_checks:: same_allocation( self , self . wrapping_byte_sub( count) ) )
12081209 ) ]
12091210 #[ ensures( |& result|
Original file line number Diff line number Diff line change @@ -1157,7 +1157,7 @@ impl<T: ?Sized> *mut T {
11571157 // Else if count is not zero, then ensure that subtracting `count` doesn't
11581158 // cause overflow and that both pointers `self` and the result are in the
11591159 // same allocation.
1160- ( ( self . addr( ) as isize ) . checked_add( count as isize ) . is_some( ) &&
1160+ ( count <= isize :: MAX as usize && ( self . addr( ) as isize ) . checked_add( count as isize ) . is_some( ) &&
11611161 core:: ub_checks:: same_allocation( self , self . wrapping_byte_add( count) ) )
11621162 ) ]
11631163 #[ ensures( |& result|
@@ -1303,7 +1303,7 @@ impl<T: ?Sized> *mut T {
13031303 // Else if count is not zero, then ensure that subtracting `count` doesn't
13041304 // cause overflow and that both pointers `self` and the result are in the
13051305 // same allocation.
1306- ( ( self . addr( ) as isize ) . checked_sub( count as isize ) . is_some( ) &&
1306+ ( count <= isize :: MAX as usize && ( self . addr( ) as isize ) . checked_sub( count as isize ) . is_some( ) &&
13071307 core:: ub_checks:: same_allocation( self , self . wrapping_byte_sub( count) ) )
13081308 ) ]
13091309 #[ ensures( |& result|
You can’t perform that action at this time.
0 commit comments