Skip to content

Branch Distances in SearchBasedFuzzer is wrong #185

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hycinth22
Copy link

@hycinth22 hycinth22 commented Apr 7, 2025

I believe last 3 lines in the table is wrong

    "| Condition | Distance True | Distance False |\n",
    "| ------------- |:-------------:| -----:|\n",
    "| a == b      | abs(a - b) | 1 |\n",
    "| a != b      | 1          | abs(a - b) |\n",
    "| a < b       | b - a + 1  | a - b      |\n",
    "| a <= b      | b - a      | a - b + 1  |\n",
    "| a > b       | a - b + 1  | b - a      |\n",

for example,
to make a<b true, we want estimate the distance betweern unstatisfied inputs and the closest statisfied inputs.
for unstatisfied inputs, a>=b . so, the distance true should be a - b + 1 instead of b - a + 1

similarly, the distance false should be b - a instead of a - b

fixed:

    "| Condition | Distance True | Distance False |\n",
    "| ------------- |:-------------:| -----:|\n",
    "| a == b      | abs(a - b) | 1 |\n",
    "| a != b      | 1          | abs(a - b) |\n",
    "| a < b       | a - b + 1  | b - a      |\n",
    "| a <= b      | a - b      | b - a + 1  |\n",
    "| a > b       | b - a + 1  | a - b      |\n",

fix Branch Distances
@hycinth22
Copy link
Author

hycinth22 commented Apr 7, 2025

The following code is right so no need to fix.

" elif op == \"Lt\":\n",
" if lhs < rhs:\n",
" distance_false = rhs - lhs\n",
" else:\n",
" distance_true = lhs - rhs + 1\n",

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.

1 participant