Skip to content

MINOR: [c] avoid signed left-shift overflow in binary varint decoder#3896

Open
arib06 wants to merge 1 commit into
apache:mainfrom
arib06:c-varint-signed-shift
Open

MINOR: [c] avoid signed left-shift overflow in binary varint decoder#3896
arib06 wants to merge 1 commit into
apache:mainfrom
arib06:c-varint-signed-shift

Conversation

@arib06

@arib06 arib06 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

cast each 7-bit group in read_long (and the big-endian float/double byte assembly) to unsigned before shifting, so a 10-byte long whose final byte sets bit 63 no longer left-shifts a signed value into the sign bit (UBSAN: left shift of 1 by 63 places in int64_t), matching the unsigned accumulation the C++ decoder already uses.

@github-actions github-actions Bot added the C label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant