This is an archive of the discontinued LLVM Phabricator instance.

[libc][NFC] Fix build when using UBSan
AbandonedPublic

Authored by abrachet on Aug 6 2020, 12:28 AM.

Details

Summary

There is a problem in memory_utils where adding an offset to a nullptr triggers ubsan (nullptr was used in tests for simplicity). As well as a problem in MPFRNumber when width is specified as 0 causing bit shift that was out of bounds.

Hopefully these changes are obvious but wanted to make sure.

Diff Detail

Event Timeline

abrachet created this revision.Aug 6 2020, 12:28 AM
abrachet requested review of this revision.Aug 6 2020, 12:28 AM
sivachandra accepted this revision.Aug 6 2020, 10:29 AM
sivachandra added a reviewer: gchatelet.

I am OK with this but added @gchatelet so that he can be aware of this.

This revision is now accepted and ready to land.Aug 6 2020, 10:30 AM

Is this still to be submitted?

It looks like I never committed this, no. Just a quick look in MPFRUtils.cpp now, it has changed substantially that I couldn't find where this shift is happening anymore. I could look more into this over the weekend

abrachet abandoned this revision.Apr 18 2022, 8:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 18 2022, 8:48 AM