[llvm-bugs] [Bug 31457] New: UB when shifting at llvm/lib/Fuzzer/FuzzerTracePC.cpp:73

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 22 22:21:33 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=31457

            Bug ID: 31457
           Summary: UB when shifting at
                    llvm/lib/Fuzzer/FuzzerTracePC.cpp:73
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: ttaubert at mozilla.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

../../fuzz/libFuzzer/FuzzerTracePC.cpp:73:33: runtime error: shift exponent
8832 is too large for 64-bit type 'uint64_t' (aka 'unsigned long')
    #0 0x540e84 in fuzzer::TracePC::FinalizeTrace(fuzzer::InputCorpus*,
unsigned long, bool)
/home/worker/nss/out/Debug/../../fuzz/libFuzzer/FuzzerTracePC.cpp:73:33
    #1 0x52abd3 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long)
/home/worker/nss/out/Debug/../../fuzz/libFuzzer/FuzzerLoop.cpp:475:32
    #2 0x529ec4 in fuzzer::Fuzzer::RunOne(std::vector<unsigned char,
std::allocator<unsigned char> > const&)
/home/worker/nss/out/Debug/../../fuzz/libFuzzer/FuzzerInternal.h:113:41
    #3 0x529ec4 in
fuzzer::Fuzzer::ShuffleAndMinimize(std::vector<std::vector<unsigned char,
std::allocator<unsigned char> >, std::allocator<std::vector<unsigned char,
std::allocator<unsigned char> > > >*)
/home/worker/nss/out/Debug/../../fuzz/libFuzzer/FuzzerLoop.cpp:451
    #4 0x5142b2 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char
const*, unsigned long))
/home/worker/nss/out/Debug/../../fuzz/libFuzzer/FuzzerDriver.cpp:523:6
    #5 0x508724 in main /home/worker/nss/out/Debug/../../fuzz/nssfuzz.cc:151:10
    #6 0x7faea9fb082f in __libc_start_main
/build/glibc-t3gR2i/glibc-2.23/csu/../csu/libc-start.c:291
    #7 0x41ee98 in _start (/home/worker/dist/Debug/bin/nssfuzz+0x41ee98)

SUMMARY: AddressSanitizer: undefined-behavior
../../fuzz/libFuzzer/FuzzerTracePC.cpp:73:33 in

Here's where it happens:

> for (size_t Idx = 0; Idx < N; Idx += Step) {
>   uint64_t Bundle = *reinterpret_cast<uint64_t*>(&Counters[Idx]);
>   if (!Bundle) continue;
>   for (size_t i = Idx; i < Idx + Step; i++) {
>     uint8_t Counter = (Bundle >> (i * 8)) & 0xff;

I'm not sure what the right fix would be, I don't understand the code well
enough to propose a fix.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161223/28be402a/attachment.html>


More information about the llvm-bugs mailing list