Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add various strategies to minimize different patterns.#2

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nth10sd merged 10 commits intoMozillaSecurity:masterfromnbp:master
May 1, 2017

Conversation

@nbp
Copy link
Contributor

@nbpnbp commentedAug 3, 2015

This pull request do multiple things, such as removing unused strategies, and add new strategies, add a--symbols way to split the test cases.

Added strategies:

  • minimize-around: This Strategy attempt at removing pairs of chuncks which might be surrounding interesting code, but which cannot be removed independently of the other. This happens frequently with patterns such as:

    a = 42;while (true) {  b = foo(a);      <-- !!!  interesting();  a = bar(b);      <-- !!!}
  • minimize-balanced: This Strategy attempt at removing balanced chuncks which might be surrounding interesting code, but which cannot be removed independently of the other. This happens frequently with patterns such as:

    ...;if (cond) {        <-- !!!  ...;  interesting();  ...;}                  <-- !!!...;

    The value of the condition might not be interesting, but in order to reach the interesting code we still have to compute it, and keep extra code alive.

  • replace-properties-by-globals: This Strategy attempt at removing members, such as other strategies can then move the lines out-side the functions. The goal is to rename variable at the same time, such as the program remains valid, while removing the dependency on the object on which the member is.

    function Foo() { this.list = [];}Foo.prototype.push = function(a) { this.list.push(a);}Foo.prototype.last = function() { return this.list.pop();}

    Which might transform the previous example to something like:

    function Foo() { list = [];}push = function(a) { list.push(a);}last = function() { return list.pop();}
  • replace-arguments-by-globals: This Strategy attempt at replacing arguments by globals, for each named argument of a function we add a setter of the global of the same name before the function call. The goal is to remove functions by making empty arguments lists instead.

    function foo(a,b) { list = a + b;}foo(2, 3)

    becomes:

    function foo() { list = a + b;}a = 2;b = 3;foo()

These patches are also adding the--symbols command line to lithium.

This option let lithium treat the file as a sequence of strings separated by tokens. The characters by which the strings are delimited are defined by the--cutBefore, and--cutAfter command-line options which default to any of?=;{[, and]}:. The cut before options, is used to stop a string if the next character is one of the character defined, The cut after options, is used to stop a string if the last character is one of the character defined. Note, the closing square braces (]) should be listed first, and the opening square braces ([) should be listed last in both of these options.

@nbp
Copy link
ContributorAuthor

nbp commentedAug 11, 2015

r?@jruderman@nth10sd

@nth10sd
Copy link
Contributor

I had tested this previously, and you've fixed the issues I've found. Nice work!

Jesse would be the one to review this, though.

@nth10sd
Copy link
Contributor

I'm using on some of the production instances, and found the following bug:

time python -u ~/nbp-lithium/lithium/lithium.py --chunksize=2 --strategy=minimize-balanced crashes --timeout=3 $tmd --fuzzing-safe --no-threads --no-baseline --no-ion bb218522.js
Intermediate files will be stored in tmp13/.
The original testcase has 1 line.
Checking that the original testcase is 'interesting'...
Exit status: CRASHED signal 11 (SIGSEGV) (2.684 seconds)
Traceback (most recent call last):
File "/Users/skywalker/nbp-lithium/lithium/lithium.py", line 1235, in
main()
File "/Users/skywalker/nbp-lithium/lithium/lithium.py", line 167, in main
strategyFunction()
File "/Users/skywalker/nbp-lithium/lithium/lithium.py", line 600, in minimizeBalancedPairs
anyChunksRemoved = tryRemovingBalancedPairs(chunkSize);
File "/Users/skywalker/nbp-lithium/lithium/lithium.py", line 643, in tryRemovingBalancedPairs
numChunks = divideRoundingUp(len(parts), chunkSize)
File "/Users/skywalker/nbp-lithium/lithium/lithium.py", line 1207, in divideRoundingUp
return (n // d) + (1 if n % d != 0 else 0)
ZeroDivisionError: integer division or modulo by zero

real 0m2.729s
user 0m0.059s
sys 0m0.027s

Used m-c rev f0c0480732d3, testcase is in:

https://bugzilla.mozilla.org/show_bug.cgi?id=1257053

@nth10sd
Copy link
Contributor

I've had to stop using --strategy=minimize-balanced on production for now. For some reason testcases were only showing up as Q10 (non-reduced) on FuzzManager and I've yet to debug this.

@nth10sd
Copy link
Contributor

@nbp, as discussed in-person, do you mind rebasing this to lithium tip?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@nbp@nth10sd

[8]ページ先頭

©2009-2025 Movatter.jp