File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
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|
You can’t perform that action at this time.
0 commit comments