ut-fix - #476
Open
DetiPrudvi08 wants to merge 6 commits into
Open
Conversation
Signed-off-by: prudvi <prudvi.deti@intel.com>
Signed-off-by: prudvi <prudvi.deti@intel.com>
There was a problem hiding this comment.
Pull request overview
This PR updates Hyperscan unit tests to use the public database-free API and adjusts a reverse-acceleration bounds check to avoid problematic integer conversions.
Changes:
- Replace internal database unprotect/free sequences in unit tests with
hs_free_database()and explicitnullptrreset where needed. - Introduce
makeDatabaseWritable()inarg_checks.cppand use it before intentional database corruption in tests. - Add a cast in
nfa_rev_api.hto make thelengthvsrAccelOffsetcheck operate insize_t.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
unit/hyperscan/single.cpp |
Switches test teardown to hs_free_database() and nulls the member pointer after free. |
unit/hyperscan/arg_checks.cpp |
Adds helper for making databases writable and updates multiple tests to use hs_free_database(). |
src/nfa/nfa_rev_api.h |
Casts rAccelOffset to size_t in RDEOD checks to keep comparisons in the correct domain. |
Comments suppressed due to low confidence (3)
unit/hyperscan/arg_checks.cpp:72
- makeDatabaseWritable() now depends on sysconf/mprotect and page-alignment assumptions, duplicating logic already provided by hs_db_unprotect(). Using hs_db_unprotect() here avoids platform-specific APIs and keeps behavior consistent with the library’s own protection mechanism.
long ps_raw = sysconf(_SC_PAGESIZE);
if (ps_raw <= 0) {
return;
}
size_t ps = (size_t)ps_raw;
unit/hyperscan/arg_checks.cpp:1162
- db_len2 is now unused after switching teardown from hs_db_free(db, db_len2) to hs_free_database(db). Removing it avoids unused-variable warnings (notably MSVC C4189).
// teardown
err = hs_free_scratch(scratch);
ASSERT_EQ(HS_SUCCESS, err);
hs_free_database(db);
unit/hyperscan/arg_checks.cpp:1439
- db_len3 is now unused after switching teardown from hs_db_free(db, db_len3) to hs_free_database(db). Removing it avoids unused-variable warnings (notably MSVC C4189).
ASSERT_EQ(HS_INVALID, err);
// teardown
hs_free_database(db);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: prudvi <prudvi.deti@intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.