Page MenuHomePhabricator

Replacing to use of ul suffix in GetMaxU64Bitfield since it not guarenteed to be 64 bit
ClosedPublic

Authored by shafik on Dec 3 2019, 4:57 PM.

Details

Summary

GetMaxU64Bitfield(...) uses the ul suffix but we require a 64 bit unsigned integer and ul could be 32 bit. So this replacing it with a explicit cast and refactors the code around it to use an early exit.

This bug came up in [[lldb-dev] Possible bug in DataExtractor::GetMaxU64Bitfield](http://lists.llvm.org/pipermail/lldb-dev/2019-November/015780.html).

Diff Detail

Event Timeline

shafik created this revision.Dec 3 2019, 4:57 PM
JDevlieghere accepted this revision.Dec 4 2019, 9:08 AM
This revision is now accepted and ready to land.Dec 4 2019, 9:08 AM
teemperor accepted this revision.Dec 4 2019, 9:37 AM

LGTM minus a small nitpick. Thanks!

lldb/source/Utility/DataExtractor.cpp
595

How about std::numeric_limits<uint64_t>::max()?

shafik updated this revision to Diff 232218.Dec 4 2019, 2:59 PM
shafik marked 2 inline comments as done.

Changing -static_cast<uint64_t>(1) to std::numeric_limits<uint64_t>::max()

lldb/source/Utility/DataExtractor.cpp
595

Good call, I thought about this change too.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2019, 10:05 AM