Skip to content

Conversation

@Dr-Emann
Copy link
Member

There are only 28 bytes of data, but a size of 36 was being passed. Instead, make this impossible: convert to a stack array, and use sizeof rather than a magic number to pass the length of data.

It isn't clear where the test data came from: the linked issue includes a base64 input of OjAAAAEAAAAAAAkAEAAAADIAMwA0ADUANgA3ADgAOgA7ADwA, which does expand to 36 bytes, so additionally, this replaces the test data with the decoded value of the data from the linked issue instead.

This was (correctly) failing in ASAN when we immediately read past the end of the string literal.

This is a bug, but a bug that only exists in the tests, no actual CRoaring code is affected.

There are only 28 bytes of data, but a size of 36 was being passed.
Instead, make this impossible: convert to a stack array, and use sizeof
rather than a magic number to pass the length of data.

It isn't clear where the test data came from: the linked issue includes
a base64 input of `OjAAAAEAAAAAAAkAEAAAADIAMwA0ADUANgA3ADgAOgA7ADwA`,
which _does_ expand to 36 bytes, so additionally, this replaces the test
data with the decoded value of the data from the linked issue instead.

This was (correctly) failing in ASAN when we immediately read past the
end of the string literal.
@Dr-Emann Dr-Emann requested a review from lemire May 11, 2025 02:19
@Dr-Emann
Copy link
Member Author

Dr-Emann commented May 11, 2025

@lemire I'm not fully sure what the test is supposed to be doing. The data from the python issue is a valid portable serialization, so maybe the change of data was intentional, but the length wasn't updated?

@lemire
Copy link
Member

lemire commented May 13, 2025

@Dr-Emann Let me have a look.

Copy link
Member

@lemire lemire left a comment

Choose a reason for hiding this comment

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

This is a good fix. I will merge immediately.

@lemire lemire merged commit e160be0 into RoaringBitmap:master May 19, 2025
6 of 20 checks passed
@lemire
Copy link
Member

lemire commented May 19, 2025

I will now proceed to verify.

@Dr-Emann Dr-Emann deleted the fix_asan_test branch August 9, 2025 03:59
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.

2 participants