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

Possible Bug - Conflict between Max Occurrence and Combinations Options #32

Open
sigkill opened this issue Mar 9, 2022 · 4 comments
Open

Comments

@sigkill
Copy link

sigkill commented Mar 9, 2022

The newer build of maskprocessor requires you to set a value of at least two for max occurrence:

--occurrence-max must be set to at least 2

However, due to this option being required, our --combinations option is now broken:

mp64.bin -1 '?u?d' '?1?1?1?1?1?1?1?1?1?1?1?1' --combinations -r2 --occurrence-max can not be used with --combinations

This was not an issue in earlier versions of maskprocessor.

@sigkill
Copy link
Author

sigkill commented Mar 9, 2022

Confirmed that the --occurrence-max works in prior commit cd717ca3f7d35fc759057d7ff8cd498acf4c6776 and 2d1a306c2aaf8a48ad35f62ff8c887d93300d45f

@sigkill
Copy link
Author

sigkill commented Mar 9, 2022

git diff cd717ca master

diff --git a/src/mp.c b/src/mp.c
index 3363ce5..1906cb6 100644
--- a/src/mp.c
+++ b/src/mp.c
@@ -462,7 +462,7 @@ int main (int argc, char *argv[])
     return (-1);
   }

-  if (occur_max == 1)
+  if (occur_max <= 1)
   {
     fprintf (stderr, "--occurrence-max must be set to at least 2\n");

@@ -922,7 +922,7 @@ int main (int argc, char *argv[])

           int occur_cnt = occurs[(int) c];

-          if (occur_cnt >= occur_max) break;
+          if (occur_cnt > occur_max) break;
         }

         if (i < len) continue;

@Skydef
Copy link

Skydef commented Jun 15, 2022

Not just this. The options --start-at and --stop-at can also no longer be used. Furthermore this if statement is now unconditional and you can no longer have an unlimited amount of character occurrences (which was previously at occur_max==0)

if (occur_max)

This was introduced in d12feb1
There is a simple fix and a pull request already exists (#25). This issue should be resolved when the pr gets merged.

@roycewilliams
Copy link
Member

@jsteube confirmed - functionality degraded until this can be fixed.

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

No branches or pull requests

3 participants