Skip to content

Fix unaligned string hash access - #954

Open
Saiteja64 wants to merge 1 commit into
LadybugDB:mainfrom
Saiteja64:fix/unaligned-string-hash
Open

Fix unaligned string hash access#954
Saiteja64 wants to merge 1 commit into
LadybugDB:mainfrom
Saiteja64:fix/unaligned-string-hash

Conversation

@Saiteja64

Copy link
Copy Markdown
Contributor

This fixes a UBSAN error in string hashing.

The hash code was reading string data as uint64_t blocks, but the string data isn't always 8-byte aligned. This happens with Ladybug's inline short strings and causes UBSAN to abort.

I changed the 8-byte load to use memcpy into a local uint64_t instead.

Also added a regression test that hashes the same bytes from aligned and intentionally misaligned memory and checks that the result is the same.

Part of #879.

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.

1 participant