Giter VIP home page Giter VIP logo

Comments (10)

DavidKorczynski avatar DavidKorczynski commented on July 25, 2024 1

I think for now I'd probably just leave a comment in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64899 saying e.g. "This timeout is valid and just takes a long time to compute. Wont fix". Then I can mark them as resolved.

If there are to many timeouts occurring so it becomes an annoyance then we can adjust the fuzzers?

from jq.

wader avatar wader commented on July 25, 2024

I wonder how similar projects handle these kinds of cases?

from jq.

emanuele6 avatar emanuele6 commented on July 25, 2024

cc @DavidKorczynski
Any suggestions?

from jq.

wader avatar wader commented on July 25, 2024

@DavidKorczynski 👍 does oss-fuzz have some limit on how many things it report per day etc? thinking if the timeouts might stop it from fuzzing?

from jq.

emanuele6 avatar emanuele6 commented on July 25, 2024

I thought it would be problematic since this can happen very easily, any large number running that test will trigger it, but maybe not.

from jq.

emanuele6 avatar emanuele6 commented on July 25, 2024

P.S. If I add something like this in jq_fuzz_fixed, will I be able to see it in the "detailed report" log on the oss-fuzz page?

diff --git a/tests/jq_fuzz_fixed.cpp b/tests/jq_fuzz_fixed.cpp
index 163eef4..88106c9 100644
--- a/tests/jq_fuzz_fixed.cpp
+++ b/tests/jq_fuzz_fixed.cpp
@@ -1,4 +1,5 @@
 #include <fuzzer/FuzzedDataProvider.h>
+#include <iostream>
 #include <string>
 
 #include "jq.h"
@@ -267,13 +268,15 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
 
   int idx = fdp.ConsumeIntegralInRange<int>(
       0, (sizeof(jq_progs) / sizeof(char *)) - 1);
+  const char *jq_prog = jq_progs[idx];
+  std::cerr << "jq_progs[" << idx << "]: " << jq_prog << std::endl;
 
   jq_state *jq = NULL;
   jq = jq_init();
   if (jq != NULL) {
     jq_set_attr(jq, jv_string("JQ_ORIGIN"), jv_string("/tmp/"));
 
-    if (jq_compile(jq, jq_progs[idx])) {
+    if (jq_compile(jq, jq_prog) {
       // Process to jv_parse and then jv_next
       jv input = jv_parse(parse_payload1.c_str());
       if (jv_is_valid(input)) {

Currently, I have just been running all the tests manually with:

jq -r '.[] | @sh "./jq -- \(.) <<< theinput # /orlessthanpathtofile"' teststhing | PS4=$ bash -x

(teststhing is adapted from the c++ source file and contains a JSON array with all the jq_progs.)

Until I reach the one that triggers problems, because I have not figured out an easy way to tell which program was used from just the seed.

from jq.

DavidKorczynski avatar DavidKorczynski commented on July 25, 2024

Until I reach the one that triggers problems, because I have not figured out an easy way to tell which program was used from just the seed.

In order to make it easy to see which program was used I'd suggest converting

const char *jq_progs[] = {
". / \", \"",
".[]",
"$ENV.PAGER",
".[0]",
". < 0.12345678901234567890123456788",
".[] == 1",
".[] | (1 / .)?",
"10 / . * 3",
"[1,2,empty,3]",
"1, empty, 2",
"[.,1]|until(.[0] < 1; [.[0] - 1, .[1] * .[0]])|.[1]",
".[-2:]",
".[-2]",
".[2]",
"[ .[] | . * 2]",
".[2:4]",
"(. + 2) * 5",
".[:3]",
".[4,2]",
"42 and \"a string\"",
"4 - .a",
into a large switch statement as opposed to array indexing -- in that we way will have line numbers in stack traces which will make it clear which program triggered a certain issues.

from jq.

wader avatar wader commented on July 25, 2024

That would be great. I've managed to reproduce using the instructions at https://google.github.io/oss-fuzz/advanced-topics/reproducing/ (had to add explicit architecture flag in some place) but being to see query and be able to possibly reproduce without the oss-fuzz setup would be nice

from jq.

DavidKorczynski avatar DavidKorczynski commented on July 25, 2024

@DavidKorczynski 👍 does oss-fuzz have some limit on how many things it report per day etc? thinking if the timeouts might stop it from fuzzing?

No limit as such. If the timeouts are really easy to trigger and it becomes spammy then I think our best option is to adjust the fuzzer.

from jq.

emanuele6 avatar emanuele6 commented on July 25, 2024

Thank you

from jq.

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.