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

Appearance settings

Mcsheng Bound fix#474

Closed
keerthimuvva52 wants to merge 1 commit into
masterintel/hyperscan:masterfrom
mcsheng_bound_fixintel/hyperscan:mcsheng_bound_fixCopy head branch name to clipboard
Closed

Mcsheng Bound fix#474
keerthimuvva52 wants to merge 1 commit into
masterintel/hyperscan:masterfrom
mcsheng_bound_fixintel/hyperscan:mcsheng_bound_fixCopy head branch name to clipboard

Conversation

@keerthimuvva52

Copy link
Copy Markdown

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds database integrity validation for McSheng NFAs to prevent out-of-bounds reads when deserializing a database.

Changes:

  • Introduces a new validator that walks McSheng 8-bit/16-bit successor tables and verifies next-state indices are within state_count.
  • Validates McSheng start states and aux table bounds against the NFA image.
  • Hooks the new validation into db_validate_rose_offsets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/database.c
Comment on lines +365 to +366
u32 as = m->alphaShift;
u32 alpha_size = 1U << as;
Comment thread src/database.c
Comment on lines +294 to +301
const char *rose_base = (const char *)rose;
const struct NfaInfo *infos =
(const struct NfaInfo *)(rose_base + rose->nfaInfoOffset);

for (u32 qi = 0; qi < rose->queueCount; qi++) {
if (unlikely((const char *)(&infos[qi + 1]) > rose_base + rose_size)) {
return HS_INVALID;
}
Comment thread src/database.c
Comment on lines +399 to +405
const u16 *succ_table =
(const u16 *)((const char *)m + sizeof(struct mcsheng));

for (u32 s = 0; s < table_states; s++) {
for (u32 a = 0; a < alpha_size; a++) {
u16 next = succ_table[s * alpha_size + a];
if (unlikely(next >= state_count)) {
Comment thread src/database.c
Comment on lines +394 to +397
if (unlikely(succ_table_bytes == 0 ||
succ_table_bytes % entry_bytes != 0)) {
return HS_INVALID;
}
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.