Skip to content

node:vm: report compileFunction body lines relative to lineOffset when it is 0 - #38240

Open
robobun wants to merge 9 commits into
mainfrom
farm/7174a843/vm-compile-function-line-offset
Open

node:vm: report compileFunction body lines relative to lineOffset when it is 0#38240
robobun wants to merge 9 commits into
mainfrom
farm/7174a843/vm-compile-function-line-offset

node:vm: report compileFunction body lines relative to lineOffset whe…

af49e73
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Aug 13, 2026 in 21m 15s

Code review found 1 important issue

Found 2 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 1
🟡 Nit 0
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/jsc/bindings/NodeVM.cpp:595-598 wrapperPrefixLength is read off the SourceOrigin, which eval/new Function providers inherit

Annotations

Check failure on line 598 in src/jsc/bindings/NodeVM.cpp

See this annotation in the file changed.

@claude claude / Claude Code Review

wrapperPrefixLength is read off the SourceOrigin, which eval/new Function providers inherit

`wrapperPrefixLength` is stored on the `NodeVMScriptFetcher` (i.e. on the `SourceOrigin`), but JSC propagates the caller's `SourceOrigin` to providers created by `eval()` / `new Function()` — so when code inside a `compileFunction` body does `eval('throw ...')` and the error escapes a vm run, `handleException` reads a nonzero prefix length off the eval frame's inherited fetcher and slices 14+ chars off the eval string before printing it as the offending line. Before this PR the eval frame's own