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

vrl_parser::parse - 'begin <= end (1 <= 0) when slicing #44

Open
stasos24 opened this issue Jul 13, 2022 · 1 comment
Open

vrl_parser::parse - 'begin <= end (1 <= 0) when slicing #44

stasos24 opened this issue Jul 13, 2022 · 1 comment
Labels
fuzz Issues found from fuzz testing type: bug A code related bug vrl: parser Changes to the syntax parser

Comments

@stasos24
Copy link

stasos24 commented Jul 13, 2022

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

vrl_parser::parser function panics when receive a crash_slice.file input
Steps to reproduce:
Download a repo with fuzz harness: https://github.com/stasos24/vector/tree/master/lib/vrl/parser/fuzzing

cargo build --bin covbuild
target/debug/covbuild < crash_escape.file

Configuration

No response

Version

v0.23.0

Debug Output

thread 'main' panicked at 'begin <= end (1 <= 0) when slicing `"`', library/core/src/str/mod.rs:111:5
stack backtrace:
   0: rust_begin_unwind
             at /rustc/38b72154ded23847cd08a796d0c6708b5efac265/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/38b72154ded23847cd08a796d0c6708b5efac265/library/core/src/panicking.rs:142:14
   2: core::str::slice_error_fail_rt
   3: core::ops::function::FnOnce::call_once
             at /rustc/38b72154ded23847cd08a796d0c6708b5efac265/library/core/src/ops/function.rs:248:5
   4: core::intrinsics::const_eval_select
             at /rustc/38b72154ded23847cd08a796d0c6708b5efac265/library/core/src/intrinsics.rs:2695:5
   5: core::str::slice_error_fail
             at /rustc/38b72154ded23847cd08a796d0c6708b5efac265/library/core/src/str/mod.rs:86:9
   6: <lookup::lookup_buf::segmentbuf::FieldBuf as core::convert::From<alloc::string::String>>::from
   7: vrl_parser::parser::__action78
   8: vrl_parser::parser::__parse__Program::__reduce245
   9: vrl_parser::parser::__parse__Program::__reduce
  10: <vrl_parser::parser::__parse__Program::__StateMachine as lalrpop_util::state_machine::ParserDefinition>::reduce
  11: covbuild::main

Example Data

crash_file

VRL source:
.s"Ws{g+ AB_3.""\"_3.""\""""

Additional Context

No response

References

No response

@stasos24 stasos24 added the type: bug A code related bug label Jul 13, 2022
@fuchsnj fuchsnj added the vrl: parser Changes to the syntax parser label Jul 13, 2022
@StephenWakely
Copy link
Contributor

The vrl source can be simplified to this and it still panics:

."""\""\""

@fuchsnj fuchsnj transferred this issue from vectordotdev/vector Mar 28, 2023
@fuchsnj fuchsnj added the fuzz Issues found from fuzz testing label May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fuzz Issues found from fuzz testing type: bug A code related bug vrl: parser Changes to the syntax parser
Projects
None yet
Development

No branches or pull requests

3 participants