Git Product home page Git Product logo

Comments (7)

markus-kusano avatar markus-kusano commented on May 6, 2024

from fuzztest.

marvi3 avatar marvi3 commented on May 6, 2024

Hello Markus,
thanks for the quick reply. That is utterly stupid of me. I did not even think about c not having strings and was just all the time wondering what was going on and what I did wrong.

I run the following commands:

CC=clang-16 CXX=clang++-16 cmake -DCMAKE_BUILD_TYPE=RelWithDebug -DFUZZTEST_FUZZING_MODE=on ..
cmake --build .

Does that mean I can not test c programms with fuzztest out of the box?

Best wishes,
marvi3

from fuzztest.

markus-kusano avatar markus-kusano commented on May 6, 2024

from fuzztest.

fniksic avatar fniksic commented on May 6, 2024

As Markus suggested, put your fuzz tests in a C++ file. Include your C header file with C language linkage:

extern "C" {
#include "my/c/header.h"
}

// Call your C functions from fuzz tests.

Then you should be good!

from fuzztest.

marvi3 avatar marvi3 commented on May 6, 2024

Thank you a lot for your reply and help.
I have tried to get it working with what you have provided but I am still failing.
I have tried both, to include my c program with the extern keyword and just changing the *.c to a *.cc ending and then adding the cpp code of fuzztest. However I had no success with this.

By the way I think I forgot to tell which SUT I want to build with FuzzTest:
It is mjs, a javascript interpreter.

I am getting a lot of error code that I do not get when building the program originally. Some errors seem to be connected with makros that try to get expanded:

./mjs.c:1650:3: error: expected identifier
LL_NONE = -1,
^
/usr/include/elf.h:2056:20: note: expanded from macro 'LL_NONE'
#define LL_NONE           0
                          ^
In file included from /home/kali/SUT/mjsFuzzTest/mjs_fuzz/fuzztest.cc:4:
./mjs.c:3847:19: error: cannot initialize a variable of type 'enum cs_log_level' with an rvalue of type 'int'
enum cs_log_level cs_log_cur_msg_level WEAK = LL_NONE;

But even when I have fixed them I get this error that I can't seem to fix without breaking other things:

In file included from /home/kali/SUT/mjsFuzzTest/mjs_fuzz/fuzztest.cc:1:
In file included from /home/kali/SUT/mjsFuzzTest/fuzztest/fuzztest/fuzztest.h:23:
In file included from /home/kali/SUT/mjsFuzzTest/fuzztest/./fuzztest/domain.h:18:
In file included from /home/kali/SUT/mjsFuzzTest/fuzztest/./fuzztest/domain_core.h:47:
/home/kali/SUT/mjsFuzzTest/fuzztest/./fuzztest/internal/domains/arbitrary_impl.h:63:3: error: static assertion failed
due to requirement 'foobar<char *>::value': => Type not supported yet. Consider filing an issue.
static_assert(foobar<T>::value,
^             ~~~~~~~~~~~~~~~~ 

This assertion fail also does not happen when I build the program on it's own.

from fuzztest.

marvi3 avatar marvi3 commented on May 6, 2024

When I fix all other problems I am left with an error:

fuzztest/./fuzztest/internal/domains/arbitrary_impl.h:63:3: error: static assertion failed due to requirement 'foobar<char *>::value': => Type not supported yet. Consider filing an issue.
  static_assert(foobar<T>::value,

So I simply commented this assertion out and then it throws the following error. So it seems like there is a problem with the value_type. I looked a bit in issues and found issue #176 where it is talked about no longer explicitly defining value_type and the change removed the value_type from InRegexImpl::DomainBase.
Could the problem I am facing be related to this ?

fuzztest/./fuzztest/internal/type_support.h:42:1: error: no type named 'value_type' in 'fuzztest::internal::ArbitraryImpl<char *>'                                                                            using value_type_t = typename Domain::value_type;

I am sorry to bother you guys with my problems but I really do not know how to continue anymore.

from fuzztest.

fniksic avatar fniksic commented on May 6, 2024

Looks like you're trying to instantiate fuzztest::Arbitrary<T>() with a type T that's not supported (which is what the static assert says).

Can you paste the fuzz test somewhere and share a link?

from fuzztest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.