Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

projects: Add GStreamer #905

Merged
merged 9 commits into from
Oct 30, 2017
Merged

projects: Add GStreamer #905

merged 9 commits into from
Oct 30, 2017

Conversation

bilboed
Copy link
Contributor

@bilboed bilboed commented Oct 19, 2017

This is an initial fuzzer which goes over ogg/theora/vorbis files
using the discoverer process

This is an initial fuzzer which goes over ogg/theora/vorbis files
using the discoverer process
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@bilboed
Copy link
Contributor Author

bilboed commented Oct 19, 2017

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

Copy link
Contributor

@Dor1s Dor1s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delayed review! Looks good, I left a few minor questions comments. Didn't review the fuzz target itself though.

@@ -0,0 +1,38 @@
# Copyright 2016 Google Inc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2017 here and in other files

################################################################################

# build project
# e.g.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove these comments please (lines 18 - 28)?

# $CXX $CXXFLAGS -std=c++11 -Iinclude \
# /path/to/name_of_fuzzer.cc -o /out/name_of_fuzzer \
# -lFuzzingEngine /path/to/library.a
BASEFLAGS="-Wno-constant-conversion -Wno-header-guard -Wno-mismatched-tags -O2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to remove -O2. We are using -O1 for fuzzing builds, as it seems to have a better balance between speed and number of branches.

mkdir -p $PREFIX
cd $WORK

env
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it really needed?

Copy link
Contributor

@Dor1s Dor1s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to select "Request changes"

@bilboed
Copy link
Contributor Author

bilboed commented Oct 20, 2017

Thanks for the review. There was indeed some cruft/comments that I removed.

@Dor1s
Copy link
Contributor

Dor1s commented Oct 20, 2017

Thanks for the cleanup Edward!

One more question: can you move fuzz target to the GStreamer repo? This is what we expect projects to do as a part of "ideal integration". Plus, it's much more convenient when you (or anyone else) need to make some changes in the fuzz target itself.

echo

cd $OUT
wget -nd https://people.freedesktop.org/~bilboed/gst-discoverer_seed_corpus.zip
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is better be done in Dockerfile

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Downloading the corpus ? Or putting it in $OUT/ ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, fixing it

cd $OUT
wget -nd https://people.freedesktop.org/~bilboed/gst-discoverer_seed_corpus.zip

cp $LIB_FUZZING_ENGINE /work/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops, leftover testing, will remove

@@ -0,0 +1,505 @@
/* GStreamer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, we encourage to have the fuzz target in the project's repository, not here.
https://github.com/google/oss-fuzz/blob/master/docs/ideal_integration.md

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also check the license.
We don't want files with such license in this repository.

- address
- memory
- undefined

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case, make sure there is a new line at EOF

primary_contact: "bilboed@bilboed.com"
sanitizers:
- address
- memory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming you've verified that msan works and doesn't give false positives right away.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I just leave the default then ? (i.e. nothing)

g_signal_connect (dc, "source-setup", (GCallback) appsrc_configuration, NULL);

info = gst_discoverer_discover_uri (dc, "appsrc://", &err);
print_info (info, err);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you print something while executing every input, fuzzing will be very inefficient (will spend all the time printing)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is one/two lines ok for debugging purposes ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you may have it under some debug switch, in case you are going to debug things locally, but for fuzzing build we need to avoid any output.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, I'll fix that.

$SRC/gst-discoverer.o \
$PLUGINS \
$BUILD_LDFLAGS \
$LIB_FUZZING_ENGINE \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused. Why do you link $OUT/gst-discoverer here and gst-discoverer above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the linking phase. The phase above is the compilation phase (C compilation vs C++ linking)

#
################################################################################

BASEFLAGS="-Wno-constant-conversion -Wno-header-guard -Wno-mismatched-tags"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will try recompiling without


WORKDIR gstreamer
COPY build.sh $SRC/
COPY gst-discoverer.c $SRC/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case, add a new line at EOF

Use the security mailing list as the primary contact
Remove explicit sanitizer listing
Removed almost all outputting

I am the original author of the code this is taken for, relicensing
an ultra-simplified version of my original code to Apache.
Data provided by the fuzzer shouldn't be freed (but the wrapping
GstBuffer should).

Avoid logging by default

echo "CFLAGS" $CFLAGS
echo "CXXFLAGS" $CXXFLAGS
export LDFLAGS="$SANITIZER_FLAGS $COVERAGE_FLAGS"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think COVERAGE_FLAGS is a part of our interface.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So which is it ? Good or not good ? :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not good :)
Just use LDFLAGS="$CXXFLAGS"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually didn't need a custom LDFLAGS. Removed it altogether

@@ -0,0 +1,152 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to setup a new repository for GStreamer for all our CI/QA stuff (still located on freedesktop/gstreamer). I'll migrate the code over there and rebase all previous commits. Thanks for your patience/review :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove custom LDFLAGS (not needed)
Use fuzzing target code from upstream repository
@bilboed
Copy link
Contributor Author

bilboed commented Oct 29, 2017

Do you want me to squash everything into one commit before upstreaming ? Instead of several fix-this, fix-this, fix-this ?

@Dor1s
Copy link
Contributor

Dor1s commented Oct 29, 2017

@bilboed, that's fine, github allows us to squash the commits altogether via single click :)

@oliverchang
Copy link
Collaborator

I think most comments have been addressed (thanks!)

I'm going to go ahead and merge this.

@oliverchang oliverchang merged commit 5a748a1 into google:master Oct 30, 2017
tmatth pushed a commit to tmatth/oss-fuzz that referenced this pull request Oct 22, 2018
* projects: Add GStreamer

This is an initial fuzzer which goes over ogg/theora/vorbis files
using the discoverer process

* gstreamer/build.sh: Cleanup file

* gstreamer/Dockerfile: Update copyright date

* gstreamer: Update project.yaml

Use the security mailing list as the primary contact
Remove explicit sanitizer listing

* gstreamer: Simplify base fuzzer

Removed almost all outputting

I am the original author of the code this is taken for, relicensing
an ultra-simplified version of my original code to Apache.

* gstreamer: Cleanup of build file and dockerfile

* gstreamer: Code minimization and avoid leaks

Data provided by the fuzzer shouldn't be freed (but the wrapping
GstBuffer should).

Avoid logging by default

* gstreamer: Download corpus in Dockerfile

And extract in build.sh

* gstreamer: Move code to repository and more cleanups

Remove custom LDFLAGS (not needed)
Use fuzzing target code from upstream repository
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants