File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
src/uucore/src/lib/features/format Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -374,7 +374,7 @@ impl Spec {
374
374
let precision = resolve_asterisk ( * precision, & mut args) ?. unwrap_or ( 0 ) ;
375
375
let i = args. get_i64 ( ) ;
376
376
377
- if precision > i32:: MAX as usize {
377
+ if precision as u64 > i32:: MAX as u64 {
378
378
return Err ( FormatError :: InvalidPrecision ( precision. to_string ( ) ) ) ;
379
379
}
380
380
@@ -397,7 +397,7 @@ impl Spec {
397
397
let precision = resolve_asterisk ( * precision, & mut args) ?. unwrap_or ( 0 ) ;
398
398
let i = args. get_u64 ( ) ;
399
399
400
- if precision > i32:: MAX as usize {
400
+ if precision as u64 > i32:: MAX as u64 {
401
401
return Err ( FormatError :: InvalidPrecision ( precision. to_string ( ) ) ) ;
402
402
}
403
403
@@ -423,7 +423,7 @@ impl Spec {
423
423
let precision = resolve_asterisk ( * precision, & mut args) ?. unwrap_or ( 6 ) ;
424
424
let f = args. get_f64 ( ) ;
425
425
426
- if precision > i32:: MAX as usize {
426
+ if precision as u64 > i32:: MAX as u64 {
427
427
return Err ( FormatError :: InvalidPrecision ( precision. to_string ( ) ) ) ;
428
428
}
429
429
Original file line number Diff line number Diff line change @@ -788,7 +788,7 @@ fn invalid_precision_fails() {
788
788
fn float_invalid_precision_fails ( ) {
789
789
// It is invalid to have length of output string greater than i32::MAX
790
790
new_ucmd ! ( )
791
- . args ( & [ "%.*f" , "9999999999 " , "0" ] )
791
+ . args ( & [ "%.*f" , "2147483648 " , "0" ] )
792
792
. fails ( )
793
- . stderr_is ( "printf: invalid precision: '9999999999 '\n " ) ;
793
+ . stderr_is ( "printf: invalid precision: '2147483648 '\n " ) ;
794
794
}
You can’t perform that action at this time.
0 commit comments