File tree Expand file tree Collapse file tree
src/uucore/src/lib/features Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,7 +117,8 @@ where
117117 // we can recover by copying the data that we have from the
118118 // intermediate pipe to stdout using normal read/write. Then
119119 // we tell the caller to fall back.
120- let mut drain = Vec :: with_capacity ( n) ; // bounded by pipe size
120+ debug_assert ! ( n <= MAX_ROOTLESS_PIPE_SIZE , "unexpected RAM usage" ) ;
121+ let mut drain = Vec :: with_capacity ( n) ;
121122 pipe_rd. take ( n as u64 ) . read_to_end ( & mut drain) ?;
122123 dest. write_all ( & drain) ?;
123124 return Ok ( true ) ;
@@ -184,7 +185,8 @@ pub fn send_n_bytes(
184185 break false ;
185186 }
186187 } else {
187- let mut drain = Vec :: with_capacity ( s) ; // bounded by pipe size
188+ debug_assert ! ( s <= MAX_ROOTLESS_PIPE_SIZE , "unexpected RAM usage" ) ;
189+ let mut drain = Vec :: with_capacity ( s) ;
188190 broker_r. take ( s as u64 ) . read_to_end ( & mut drain) ?;
189191 target. write_all ( & drain) ?;
190192 break true ;
You can’t perform that action at this time.
0 commit comments