[PATCH] D29831: [libFuzzer] Use long long to ensure 64 bits.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 10 09:25:39 PST 2017


Should you be using stoull? Since the result is going into an unsigned
On Fri, Feb 10, 2017 at 9:20 AM Marcos Pividori via Phabricator <
reviews at reviews.llvm.org> wrote:

> mpividori created this revision.
>
> This fix errors when compiling for 64 bits on Windows, where longs are 4
> bytes.
>
>
> https://reviews.llvm.org/D29831
>
> Files:
>   lib/Fuzzer/FuzzerTracePC.cpp
>
>
> Index: lib/Fuzzer/FuzzerTracePC.cpp
> ===================================================================
> --- lib/Fuzzer/FuzzerTracePC.cpp
> +++ lib/Fuzzer/FuzzerTracePC.cpp
> @@ -138,7 +138,7 @@
>              sizeof(ModulePathRaw), &OffsetRaw))
>        continue;
>      std::string Module = ModulePathRaw;
> -    uintptr_t FixedPC = std::stol(FixedPCStr, 0, 16);
> +    uintptr_t FixedPC = std::stoll(FixedPCStr, 0, 16);
>      uintptr_t PcOffset = reinterpret_cast<uintptr_t>(OffsetRaw);
>      ModuleOffsets[Module] = FixedPC - PcOffset;
>      CoveredPCsPerModule[Module].push_back(PcOffset);
> @@ -183,7 +183,7 @@
>        if (PcOffsetEnd == std::string::npos)
>          continue;
>        S.resize(PcOffsetEnd);
> -      uintptr_t PcOffset = std::stol(S, 0, 16);
> +      uintptr_t PcOffset = std::stoll(S, 0, 16);
>        if (!std::binary_search(CoveredOffsets.begin(),
> CoveredOffsets.end(),
>                                PcOffset)) {
>          uintptr_t PC = ModuleOffset + PcOffset;
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170210/0f4d71d3/attachment.html>


More information about the llvm-commits mailing list