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

FDP misuses: ConsumeBytes and sizes #301

Open
oliverchang opened this issue May 31, 2024 · 0 comments
Open

FDP misuses: ConsumeBytes and sizes #301

oliverchang opened this issue May 31, 2024 · 0 comments
Labels
enhancement New feature or request prompt-engineering

Comments

@oliverchang
Copy link
Collaborator

A lot of our current generated fuzz targets have the following misuse of FDP:

  const size_t src_size = stream.ConsumeIntegralInRange<size_t>(0, 1024);
  std::vector<uint8_t> src = stream.ConsumeBytes<uint8_t>(src_size);

  // Call the function being tested.
  func(src.data(), src_size);

This makes an assumption that stream.ConsumeBytes will always return the requested number of bytes. This is not the case -- it will return at most the number of bytes remaining in the input stream.

This will lead to false positive crashes.

@oliverchang oliverchang changed the title FDP misuses: ConsumeBytes FDP misuses: ConsumeBytes and sizes May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request prompt-engineering
Projects
None yet
Development

No branches or pull requests

1 participant