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

fix(codegen): source map builder panicked because it attempted to subtract with overflow in search_original_line_and_column #8185

Merged

Conversation

Dunqing
Copy link
Member

@Dunqing Dunqing commented Dec 29, 2024

See: https://github.com/oxc-project/monitor-oxc/actions/runs/12531534720/job/34949348092
Related: #7926

This line causes panic.

let line = &self.line_offset_tables.lines[original_line];
let mut original_column = position - line.byte_offset_to_start_of_line;

After investigation, I found that the root cause was the code removed in this PR. I don’t understand what the code was used for, but it was obviously wrong. Because idx is always smaller than cap

Copy link
Member Author

Dunqing commented Dec 29, 2024


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-codegen Area - Code Generation C-bug Category - Bug labels Dec 29, 2024
@Dunqing Dunqing changed the title fix(sourcemap): panic when search_original_line_backwards fix(codegen): source map builder panicked because it attempted to subtract with overflow in search_original_line_and_column Dec 29, 2024
Copy link

codspeed-hq bot commented Dec 29, 2024

CodSpeed Performance Report

Merging #8185 will not alter performance

Comparing 12-29-fix_sourcemap_panic_when_search_original_line_backwards (08b84a2) with main (cfb51f2)

Summary

✅ 29 untouched benchmarks

@Dunqing Dunqing requested a review from camc314 December 29, 2024 15:48
@Dunqing Dunqing force-pushed the 12-29-fix_sourcemap_panic_when_search_original_line_backwards branch from 46fc1a8 to 08b84a2 Compare December 29, 2024 15:49
@shulaoda
Copy link
Contributor

shulaoda commented Dec 30, 2024

I also encountered this issue while running the rolldown ci benchmark.

> bench@ bench-ci D:\shulaoda\rolldown\packages\bench
> node ./benches/ci.js

thread 'tokio-runtime-worker' panicked at C:\Users\dalaoshu\.cargo\registry\src\index.crates.io-6f17d22bba15001f\oxc_codegen-0.44.0\src\sourcemap_builder.rs:153:35:
attempt to subtract with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@Boshen Boshen merged commit 8ed9766 into main Dec 31, 2024
27 checks passed
@Boshen Boshen deleted the 12-29-fix_sourcemap_panic_when_search_original_line_backwards branch December 31, 2024 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area - Code Generation C-bug Category - Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants