bug(stat): Parser Edge Cases (--format option) (Fuzzing Part 1)

Đã đóng
#15,348 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Franklin-Qi đang làm issue này rồi.

Từ ngày 16/10/2026.

  • #15352 của @ozenyunus35 — đã đóng, không merge
  • #15411 của @Franklin-Qi — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
22/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
cli

Hướng nghiên cứu

Start by reproducing the stat --format cases in the issue against the built binary and comparing them with GNU stat's invalid directive errors. Pull request #15352 is already open against this issue, so read it first to see what it covers. Done means the malformed directives in the report fail with an invalid-directive error like GNU's, and the reproduction cases match GNU output.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

U - stat

Hi, uutils mainteners, i hope everything good

we fuzzed the stat parser for edge cases via manual fuzzing ourselves and we discovered as for now one edge case

relunsec@relunsec:~/software/coreutils/target/debug$ ./stat --format='%++-+%1212x' /
?1212x
relunsec@relunsec:~/software/coreutils/target/debug$ gnustat --format='%++-+%1212x' /
gnustat: ‘%++-+%’: invalid directive
relunsec@relunsec:~/software/coreutils/target/debug$ 

same for

relunsec@relunsec:~/software/coreutils/target/debug$ ./stat --format=$'%++-+-s%1212x' / 
+28                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         2026-10-14 04:31:58.902392402 -0400
relunsec@relunsec:~/software/coreutils/target/debug$ gnustat --format=$'%++-+-s%1212x' / 
28                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         2026-10-14 04:31:58.902392402 -0400
relunsec@relunsec:~/software/coreutils/target/debug$ 

also we discovered

relunsec@relunsec:~/software/coreutils/target/debug$ ./stat --format=$'%+-%%ss%1212x' / 
?28s                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         2026-10-14 04:31:58.902392402 -0400
relunsec@relunsec:~/software/coreutils/target/debug$ gnustat --format=$'%+-%%ss%1212x' / 
gnustat: ‘%+-%’: invalid directive
relunsec@relunsec:~/software/coreutils/target/debug$ 

can be with just

same as

relunsec@relunsec:~/software/coreutils/target/debug$ ./stat --format=$'%s%0%%' / 
28?%
relunsec@relunsec:~/software/coreutils/target/debug$ gnustat --format=$'%s%0%%' / 
28gnustat: ‘%0%’: invalid directive
relunsec@relunsec:~/software/coreutils/target/debug$ 
relunsec@relunsec:~/software/coreutils/target/debug$ ./stat --format=$'%-%s1212x' / 
?s1212x
relunsec@relunsec:~/software/coreutils/target/debug$ gnustat --format=$'%-%s1212x' / 
gnustat: ‘%-%’: invalid directive
relunsec@relunsec:~/software/coreutils/target/debug$ 

reproduces this issue
seems similar as below but with different input

same as

relunsec@relunsec:~/software/coreutils/target/debug$ ./stat --format '%#%d' --file-system /
?d
relunsec@relunsec:~/software/coreutils/target/debug$ gnustat --format '%#%d' --file-system /
gnustat: ‘%#%’: invalid directive

as i see gnu errors out, uutils no for invalid directive

and then same for

relunsec@relunsec:~/software/coreutils/target/debug$ ./stat --format '%s%#%#b' --file-system /
131072?#b
relunsec@relunsec:~/software/coreutils/target/debug$ gnustat --format '%s%#%#b' --file-system /
131072gnustat: ‘%#%’: invalid directive
relunsec@relunsec:~/software/coreutils/target/debug$ 
Ngôn ngữ chính
Rust
Star
24.3k
Fork
2.1k
Merge trung bình
1 ngày 20 giờ
Pull request đã merge (30 ngày)
380

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của uutils/coreutils

Tất cả issue của uutils/coreutils

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.