This is an archive of the discontinued LLVM Phabricator instance.

[libc] Fix HPD on extremely long numbers
ClosedPublic

Authored by michaelrj on Aug 16 2023, 2:14 PM.

Details

Summary

The fuzzer found that a 100,000 digit number could possibly return an
incorrect result. This patch fixes the issue.

Diff Detail

Event Timeline

michaelrj created this revision.Aug 16 2023, 2:14 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 16 2023, 2:14 PM
michaelrj requested review of this revision.Aug 16 2023, 2:14 PM
lntue accepted this revision.Aug 17 2023, 7:22 AM
This revision is now accepted and ready to land.Aug 17 2023, 7:22 AM

Is it possible to add tests?

Adding tests is impractical. To trigger the bug a number would have to be more than 100,000 digits long. Given the rarity of numbers like that I'm willing to accept a small amount of risk of a regression.

michaelrj updated this revision to Diff 551285.Aug 17 2023, 3:00 PM

I was wrong. I've added tests. They don't test the behavior directly, but they're the best I can do without 100k of zeroes. Also I increased the maximum exponent HPD will store to 2^30, which is ~1 billion. If we discover this limit is too low I will be shocked.

This revision was landed with ongoing or failed builds.Aug 18 2023, 11:04 AM
This revision was automatically updated to reflect the committed changes.