Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some unicode input may cause print_help and print_long_help panic(found by afl.rs) #2264

Closed
StevenJiang1110 opened this issue Dec 23, 2020 · 3 comments
Labels
C-bug Category: Updating dependencies

Comments

@StevenJiang1110
Copy link

StevenJiang1110 commented Dec 23, 2020

Code

extern crate clap;
fn main() {
    let param0 = "00000000000000-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 璀璀璀";
    let mut app_ = clap::SubCommand::with_name(param0);
    let _ = clap::App::print_long_help(&mut app_);
}

or

extern crate clap;
fn main() {
    let app_ = clap::SubCommand::with_name("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000-қ00000000000000000 蚝");
    let mut app2_ = clap::App::display_order(app_ ,3472328296227680304);
    let _ = clap::App::print_help(&mut app2_);
}

Steps to reproduce the issue

  1. Run cargo run
    The bug report is as follows.
    截屏2020-12-23 下午7 30 13

Version

  • Rust: rustc 1.46.0-dev
  • Clap: 2.33.3
[dependencies]
clap = { version = "2.33.3" }

I also put reproduce files at print_help
and print_long_help
I hope you can check if this is a bug. Thanks a lot.

@StevenJiang1110 StevenJiang1110 added the C-bug Category: Updating dependencies label Dec 23, 2020
@pksunkara
Copy link
Member

Please try with master.

@StevenJiang1110
Copy link
Author

I tried and it seems the master has removed the subCommand.
截屏2020-12-23 下午8 19 36

@ldm0
Copy link
Member

ldm0 commented Dec 23, 2020

@StevenJiang1110 The Subcommand is integrated with App now, and the corresponding codes are:

fn main() {
    let param0 = "00000000000000-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 璀璀璀";
    let mut app_ = clap::App::new(param0);
    let _ = clap::App::print_long_help(&mut app_);
}

and:

fn main() {
    let app_ = clap::App::new("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000-қ00000000000000000 蚝");
    let mut app2_ = clap::App::display_order(app_ ,3472328296227680304);
    let _ = clap::App::print_help(&mut app2_);
}

Both work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Updating dependencies
Projects
None yet
Development

No branches or pull requests

3 participants