Skip to content

hfuzz-cc seems to be failing to compile code from stdin #431

@evverx

Description

@evverx

Trying to build elfutils with various fuzzing engines I ran into what seems to be a bug in hfuzz-cc:

echo "int main() { return 1; }" | hfuzz-gcc -g -xc -

2021-12-18T19:22:17.5920479Z /tmp/libhfnetdriver.0.e2d9a39cafc710dc.a:1:1: error: expected identifier or '(' before '!' token
2021-12-18T19:22:17.5921331Z     1 | !<arch>
2021-12-18T19:22:17.5921659Z       | ^
2021-12-18T19:22:17.5922560Z /tmp/libhfnetdriver.0.e2d9a39cafc710dc.a:2:59: error: stray '`' in program
2021-12-18T19:22:17.5923350Z     2 | /               0           0     0     0       222       `
2021-12-18T19:22:17.5923750Z       |                                                           ^
2021-12-18T19:22:17.5924579Z /tmp/libhfnetdriver.0.e2d9a39cafc710dc.a:3:1: warning: null character(s) ignored
2021-12-18T19:22:17.5927546Z     3 |    ^G  ^A"  ^A"  ^A"  ^A"  ^A"  ^A"  ^A"HonggfuzzNetDriverPort HonggfuzzNetDriverArgsForServer HonggfuzzNetDriverTempdir HonggfuzzNetDriverServerAddress LLVMFuzzerInitialize LLVMFuzzerTestOneInput LIBHFNETDRIVER_module_netdriver  netdriver.o/    0           0     0     644     58648     `
2021-12-18T19:22:17.5929594Z       | ^
2021-12-18T19:22:17.5930600Z /tmp/libhfnetdriver.0.e2d9a39cafc710dc.a:3:4: error: stray '\7' in program
2021-12-18T19:22:17.5933633Z     3 |    ^G  ^A"  ^A"  ^A"  ^A"  ^A"  ^A"  ^A"HonggfuzzNetDriverPort HonggfuzzNetDriverArgsForServer HonggfuzzNetDriverTempdir HonggfuzzNetDriverServerAddress LLVMFuzzerInitialize LLVMFuzzerTestOneInput LIBHFNETDRIVER_module_netdriver  netdriver.o/    0           0     0     644     58648     `
2021-12-18T19:22:17.5935664Z       |    ^
2021-12-18T19:22:17.5936516Z /tmp/libhfnetdriver.0.e2d9a39cafc710dc.a:3:5: warning: null character(s) ignored
2021-12-18T19:22:17.5939307Z     3 |    ^G  ^A"  ^A"  ^A"  ^A"  ^A"  ^A"  ^A"HonggfuzzNetDriverPort HonggfuzzNetDriverArgsForServer HonggfuzzNetDriverTempdir HonggfuzzNetDriverServerAddress LLVMFuzzerInitialize LLVMFuzzerTestOneInput LIBHFNETDRIVER_module_netdriver  netdriver.o/    0           0     0     644     58648     `
2021-12-18T19:22:17.5940789Z       |     ^
...

To get it around I replaced command lines like that with commands using temporary files.

honggfuzz was built using the top of the master branch (c83f254) and below are the versions of the underlying compilers:

$ hfuzz-gcc --version
gcc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ hfuzz-clang --version
clang version 13.0.0 (Fedora 13.0.0-3.fc35)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions