1 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2 // See https://llvm.org/LICENSE.txt for license information.
3 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5 // Triggers the bug described here:
6 // https://github.com/google/oss-fuzz/issues/2369#issuecomment-490240627
8 // In a nutshell, MSan's parameter shadow does not get unpoisoned before calls
9 // to LLVMFuzzerTestOneInput. This test case causes the parameter shadow to be
10 // poisoned by the call to foo(), which will trigger an MSan false positive on
11 // the Size == 0 check if the parameter shadow is still poisoned.
17 volatile int zero
= 0;
18 __attribute__((noinline
)) int foo(int arg1
, int arg2
) { return zero
; }
20 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data
, size_t Size
) {
24 // Pass uninitialized values to foo(). Since foo doesn't do anything with
25 // them, MSan should not report an error here.