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

giving pattern with null to hs_compile_lit_multi #427

Open
chkp-michaelgo opened this issue Feb 4, 2024 · 1 comment
Open

giving pattern with null to hs_compile_lit_multi #427

chkp-michaelgo opened this issue Feb 4, 2024 · 1 comment

Comments

@chkp-michaelgo
Copy link

At first I tried to use lens to hs_compile_lit_multi to indicate that null should be treated as 8 bit integer with value 0 and not as a terminator. It did not work, it ignored the lens argument and treated zero value as terminator, if it was the first character it threw an error.

I tried to use \x00 . \x worked for values that are not 00 just fine. For \x00 it did not throw exceptions even when it was at the start of the pattern, but it did not match on buffers with nulls either.

Is there a flag to force hs_compile_lit_multi to treat the input patterns as raw data and not perform any unescaping or special treatment of \xXX or \0 and just treat the lens argument as the actual lengths of the patterns?

Is there a flag to make hs_compile_lit_multi treat all escape sequences including \x00 and \0 consistently?

@chkp-michaelgo
Copy link
Author

A small clarification - the documentation https://intel.github.io/hyperscan/dev-reference/compilation.html clearly states that null does not indicate the length and that lens argument is what controls the length so this is seems like a bug.

For new APIs, the length of each literal pattern is a newly added parameter. Hyperscan needs to locate the end position of the input expression via clearly knowing each literal’s length, not by simply identifying character \0 of a string.

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

1 participant