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(sourcemaps): prevent possible integer overflow #10782

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dylan-conway
Copy link
Collaborator

What does this PR do?

-(minInt(T)) will overflow if T is signed

This pr hardcodes what encodeVLQ would return if value is minInt(i32)

  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

How did you verify your code works?

manual

Copy link

github-actions bot commented May 3, 2024

@dylan-conway, your commit has failing tests :(

💪 4 failing tests Darwin AARCH64

💻 3 failing tests Darwin x64 baseline

💻 1 failing tests Darwin x64

🪟💻 8 failing tests Windows x64 baseline

🪟💻 8 failing tests Windows x64

View logs

Copy link
Contributor

@gvilums gvilums left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to add a test for this?

else
@as(u32, @bitCast((-value << 1) | 1));
// `-value` will overflow if it's a signed minInt(T)
return .{ .bytes = .{ 104, 103, 103, 103, 103, 103, 69, 0 }, .len = 7 };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a comment explaining this magic value would be helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants