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

🐛 Stack overflow when liniting file #5218

Open
1 task done
qarmin opened this issue Feb 28, 2025 · 4 comments
Open
1 task done

🐛 Stack overflow when liniting file #5218

qarmin opened this issue Feb 28, 2025 · 4 comments
Labels
A-Parser Area: parser S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@qarmin
Copy link

qarmin commented Feb 28, 2025

Environment information

Self compiled biome on Linux - d95df40a86c8debb369fdc9070c91642325bfe1f

What happened?

File content(at the bottom should be attached raw, not formatted file - github removes some non-printable characters, so copying from here may not work) - this output is stripped - if there is no crash without address sanitizer, just duplicate more lines:

'' +
'' +
'' +
'' +
? 
'' +
'' +
'' +
'' +
'' +
'' +
'' +

command

timeout -v 150 biome lint TEST___FILE.ts

App was compiled with nightly rust compiler to be able to use address sanitizer
(You can ignore this part if there is no address sanitizer error)
On Ubuntu 24.04, the commands to compile were:

rustup default nightly
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
rustup component add llvm-tools-preview --toolchain nightly-x86_64-unknown-linux-gnu

export RUST_BACKTRACE=1 # or full depending on project
export ASAN_SYMBOLIZER_PATH=$(which llvm-symbolizer-18)
export ASAN_OPTIONS=symbolize=1
RUSTFLAGS="-Zsanitizer=address" cargo +nightly build --target x86_64-unknown-linux-gnu

cause this

AddressSanitizer:DEADLYSIGNAL
=================================================================
==411791==ERROR: AddressSanitizer: stack-overflow on address 0x7bc255000ea8 (pc 0x561b7c9a9b06 bp 0x7bc2550016f0 sp 0x7bc255000eb0 T1)
    #0 0x561b7c9a9b06 in __asan_memcpy /rustc/llvm/src/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:63:3
    #1 0x561b7ff5f3bf in biome_js_syntax::expr_ext::_$LT$impl$u20$biome_js_syntax..generated..nodes..AnyJsExpression$GT$::omit_parentheses::h6f28b65048776b73 /home/runner/work/Automated-Fuzzer/Automated-Fuzzer/biome-main/crates/biome_js_syntax/src/expr_ext.rs:897:20
    #2 0x561b7f606427 in biome_js_analyze::ast_utils::is_constant_condition::hbf4874af6cf7a06e /home/runner/work/Automated-Fuzzer/Automated-Fuzzer/biome-main/crates/biome_js_analyze/src/ast_utils.rs:75:11
    #245 0x561b7f606d3f in biome_js_analyze::ast_utils::is_constant_condition::hbf4874af6cf7a06e /home/runner/work/Automated-Fuzzer/Automated-Fuzzer/biome-main/crates/biome_js_analyze/src/ast_utils.rs:93:37
    #246 0x561b7f606d3f in biome_js_analyze::ast_utils::is_constant_condition::hbf4874af6cf7a06e /home/runner/work/Automated-Fuzzer/Automated-Fuzzer/biome-main/crates/biome_js_analyze/src/ast_utils.rs:93:37

SUMMARY: AddressSanitizer: stack-overflow /home/runner/work/Automated-Fuzzer/Automated-Fuzzer/biome-main/crates/biome_js_syntax/src/expr_ext.rs:897:20 in biome_js_syntax::expr_ext::_$LT$impl$u20$biome_js_syntax..generated..nodes..AnyJsExpression$GT$::omit_parentheses::h6f28b65048776b73
Thread T1 created by T0 here:
    #0 0x561b7c990311 in pthread_create /rustc/llvm/src/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:250:3
    #1 0x561b80436373 in std::sys::pal::unix::thread::Thread::new::ha706132eadff3018 /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library/std/src/sys/pal/unix/thread.rs:88:19
    #2 0x561b7faf0708 in std::thread::Builder::spawn_unchecked_::h4fa4b2f887b36ab7 /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:598:30
    #3 0x561b7faf0708 in std::thread::Builder::spawn_unchecked::hd0039e7b81a35cde /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:467:32
    #4 0x561b7fae551c in std::thread::Builder::spawn::h5a6c4eed766cece7 /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:399:18
    #5 0x561b7fae551c in _$LT$rayon_core..registry..DefaultSpawn$u20$as$u20$rayon_core..registry..ThreadSpawn$GT$::spawn::h739eca23e94a0915 /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:98:11
    #6 0x561b7e2fbc25 in rayon_core::registry::Registry::new::h543e75fca3695d75 /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:304:29
    #7 0x561b7e2fbc25 in rayon_core::registry::init_global_registry::_$u7b$$u7b$closure$u7d$$u7d$::h305225f4bbbd899b /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:179:28
    #8 0x561b7e2fbc25 in rayon_core::registry::set_global_registry::_$u7b$$u7b$closure$u7d$$u7d$::hf39ba00f196c302c /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:193:18
    #9 0x561b7e2fbc25 in std::sync::poison::once::Once::call_once::_$u7b$$u7b$closure$u7d$$u7d$::h9ea9508a843f6154 /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/poison/once.rs:155:41
    #10 0x561b8043a853 in std::sys::sync::once::futex::Once::call::h038447fbf49a7656 /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library/std/src/sys/sync/once/futex.rs:176:21
    #11 0x561b7e2fab56 in std::sync::poison::once::Once::call_once::h20c8d66b76f4966d /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/poison/once.rs:155:9
    #12 0x561b7e2fab56 in rayon_core::registry::set_global_registry::hccf057563eb8b8bd /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:192:5
    #13 0x561b7e2fab56 in rayon_core::registry::init_global_registry::h6fb854506549ce2b /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:179:5
    #14 0x561b7e2fab56 in rayon_core::ThreadPoolBuilder$LT$S$GT$::build_global::h16acd26739ec0efb /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/lib.rs:288:24
    #15 0x561b7e2fab56 in biome_service::workspace::server::init_thread_pool::_$u7b$$u7b$closure$u7d$$u7d$::h0c8bc128264e844d /home/runner/work/Automated-Fuzzer/Automated-Fuzzer/biome-main/crates/biome_service/src/workspace/server.rs:1344:13
    #16 0x561b7e2fab56 in std::sync::poison::once::Once::call_once::_$u7b$$u7b$closure$u7d$$u7d$::h1002bd9e1ec87462 /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/poison/once.rs:155:41
    #17 0x561b8043a853 in std::sys::sync::once::futex::Once::call::h038447fbf49a7656 /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library/std/src/sys/sync/once/futex.rs:176:21
    #18 0x561b7e320a45 in std::sync::poison::once::Once::call_once::hb7aba261121c92ad /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/poison/once.rs:155:9
    #19 0x561b7e320a45 in biome_service::workspace::server::init_thread_pool::hea7a83f75dc4f79d /home/runner/work/Automated-Fuzzer/Automated-Fuzzer/biome-main/crates/biome_service/src/workspace/server.rs:1343:9
    #20 0x561b7e320a45 in biome_service::workspace::server::WorkspaceServer::new::h3c7d0fbdeba3008e /home/runner/work/Automated-Fuzzer/Automated-Fuzzer/biome-main/crates/biome_service/src/workspace/server.rs:143:9
    #21 0x561b7e79a6ce in biome_service::workspace::server::hd62cec92aa441380 /home/runner/work/Automated-Fuzzer/Automated-Fuzzer/biome-main/crates/biome_service/src/workspace.rs:1211:14
    #22 0x561b7cb4eead in biome::run_workspace::h71b1e26b1a7b6cf6 /home/runner/work/Automated-Fuzzer/Automated-Fuzzer/biome-main/crates/biome_cli/src/main.rs:69:9
    #23 0x561b7cb4eead in biome::main::he2d2be261c5f9168 /home/runner/work/Automated-Fuzzer/Automated-Fuzzer/biome-main/crates/biome_cli/src/main.rs:44:18
    #24 0x561b7cb2e392 in core::ops::function::FnOnce::call_once::he0de4a20fab6fdc0 /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
    #25 0x561b7cb2e392 in std::sys::backtrace::__rust_begin_short_backtrace::hf8dbd3cb8188f936 /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:152:18
    #26 0x561b7cafffeb in std::rt::lang_start::h71dadb7aa059e5ab /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:198:5
    #27 0x7fc258a2a1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #28 0x7fc258a2a28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #29 0x561b7c91f2c4 in _start (/home/runner/.cargo/bin/biome+0x181c2c4) (BuildId: 8cfbaeb28451ba5d6b6190427af1dd8be4650ff9)

==411791==ABORTING

##### Automatic Fuzzer note, output status "Some(1)", output signal "None"

compressed.zip

Expected result

No crash

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@qarmin qarmin added the S-Needs triage Status: this issue needs to be triaged label Feb 28, 2025
@arendjr
Copy link
Contributor

arendjr commented Mar 12, 2025

I tried reproducing this issue, but it didn't trigger anything for me. I did notice the content in the attached zip file and the snippet in the report aren't the same. I tried both, and neither resulted in an error. I also tried repeating the block in the issue a bunch of times, but that didn't result in anything either.

However, the pattern did remind of the case I fixed here: #4856

Could it be this is a duplicate? I did check that d95df40 was a commit from after next was merged back into main, so the fix should've been included.

@arendjr arendjr added S-Needs repro Status: needs a reproduction and removed S-Needs triage Status: this issue needs to be triaged labels Mar 12, 2025
Copy link
Contributor

Hello @qarmin, please provide a minimal reproduction. You can use one of the following options:

  • Provide a link to our playground, if it's applicable.
  • Provide a link to GitHub repository. To easily create a reproduction, you can use our interactive CLI via npm create @biomejs/biome-reproduction

Issues marked with S-Needs repro will be closed if they have no activity within 3 days.

@qarmin
Copy link
Author

qarmin commented Mar 12, 2025

It looks like I added an invalid file (probably intended for the project OXC).

I can reproduce the problem with this binary (ASan on Linux): https://github.com/qarmin/Automated-Fuzzer/releases/download/Nightly/biome.7z

The issue occurs with these files: REPORTS___BIOME.zip

which were taken from: https://github.com/qarmin/Automated-Fuzzer/actions/runs/13774919827

@arendjr
Copy link
Contributor

arendjr commented Mar 13, 2025

Thanks!

@arendjr arendjr added A-Parser Area: parser S-Bug-confirmed Status: report has been confirmed as a valid bug and removed S-Needs repro Status: needs a reproduction labels Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Parser Area: parser S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

No branches or pull requests

2 participants