Skip to content

chore: Avoid left-shift of negative values port google/jsonnet#1288#612

Merged
stephenamar-db merged 1 commit intodatabricks:masterfrom
He-Pin:left-shift
Feb 27, 2026
Merged

chore: Avoid left-shift of negative values port google/jsonnet#1288#612
stephenamar-db merged 1 commit intodatabricks:masterfrom
He-Pin:left-shift

Conversation

@He-Pin
Copy link
Contributor

@He-Pin He-Pin commented Feb 27, 2026

Avoid left-shift of negative values port

Copilot AI review requested due to automatic review settings February 27, 2026 12:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR ports a fix from google/jsonnet#1288 that prevents undefined behavior when left-shifting negative values. The fix ensures that overflow detection for bitwise left-shift operations works correctly for both positive and negative operands by using the absolute value in the comparison.

Changes:

  • Updated overflow check in left-shift operation to use math.abs(ll) instead of ll when validating if the shift would exceed safe integer range

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@stephenamar-db stephenamar-db merged commit 8c3a8cd into databricks:master Feb 27, 2026
14 of 16 checks passed
@He-Pin He-Pin deleted the left-shift branch February 28, 2026 00:35
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.

3 participants