fix: use the computed size of the Offsets struct instead of hard-co… (#25816)

### What does this PR do?

- I was trying to understand how the SEA bundling worked in Bun and
noticed the size of the `Offsets` struct is hard-coded here to 32. It
should use the computed size to be future proof to changes in the
schema.

### How did you verify your code works?

- I didn't. Can add tests if this is not covered by existing tests.
ChatGPT agreed with me though. =)
This commit is contained in:
Andrew Johnston
2026-01-06 15:04:28 +00:00
committed by GitHub
parent 370e6fb9fa
commit 3de2dc1287

View File

@@ -1213,7 +1213,7 @@ pub const StandaloneModuleGraph = struct {
}
}
if (read_amount < trailer.len + @sizeOf(usize) + 32)
if (read_amount < trailer.len + @sizeOf(usize) + @sizeOf(Offsets))
// definitely missing data
return null;