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

capacity overflow error on cyme --lsusb --verbose on cyme 1.8.0 macOS #25

Closed
nervous-inhuman opened this issue Jul 15, 2024 · 5 comments

Comments

@nervous-inhuman
Copy link

nervous-inhuman commented Jul 15, 2024

After updating to 1.8.0 (and switching over to the homebrew-core), I'm getting the following error when running cyme with --lsusb and --verbose options on macOS 14.5 (23F79)

...
thread 'main' panicked at library/alloc/src/raw_vec.rs:25:5:
capacity overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Running with RUST_BACKTRACE=full

thread 'main' panicked at library/alloc/src/raw_vec.rs:25:5:
capacity overflow
stack backtrace:
   0:        0x1030eea88 - __mh_execute_header
   1:        0x102ec37e0 - __mh_execute_header
   2:        0x1030dff9c - __mh_execute_header
   3:        0x1030ee784 - __mh_execute_header
   4:        0x1030ec238 - __mh_execute_header
   5:        0x1030ed360 - __mh_execute_header
   6:        0x1030eee50 - __mh_execute_header
   7:        0x1030eede4 - __mh_execute_header
   8:        0x1030ec3c8 - __mh_execute_header
   9:        0x1030f4098 - __mh_execute_header
  10:        0x102e93bdc - __mh_execute_header
  11:        0x102e93b74 - __mh_execute_header
  12:        0x102f6cb54 - __mh_execute_header
  13:        0x102f68fec - __mh_execute_header
  14:        0x102e6dc64 - __mh_execute_header
@tuna-f1sh
Copy link
Owner

tuna-f1sh commented Jul 15, 2024

Sounds like I missed a bitshift of a u8 beyond its type porting some lsusb code - was hard to cover it all. Scratch that sounds like some thing worse

Can you list the devices you have attached with cyme --tree -vvv so I have an idea what descriptor to look at?

@nervous-inhuman
Copy link
Author

It doesn't seem to trigger without --lsusb, but here's the output for both with and without
cyme_lsusb_tree_vvv.log
cyme_tree_vvv.log
^ Still contains bash escape codes

@tuna-f1sh
Copy link
Owner

Thanks. Since it panics after ‘VCONN Power’ it must be this https://github.com/tuna-f1sh/cyme/blob/main/src/lsusb/bos_dumps.rs#L241 - the slice is a fixed [u8; 32] so I believe the code is valid but need to think deeper.

I forgot to ask for the —json flag for the dump without lsusb (cyme —tree -vvv —json), that way I can run it on my machine to test a fix.

@tuna-f1sh
Copy link
Owner

tuna-f1sh commented Jul 16, 2024

Actually, I see what is the issue: the dump_value function using repeat to get spaces. Since that String will be 95 bytes - longer than the width - the arg passed to repeat must be rolling over and so be > usize::MAX. I'll post a fix in a bit.

@tuna-f1sh
Copy link
Owner

Should be fixed with 392e046

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants