Skip to content

Fix for PSIRT PTK0008456 - #468

Closed
keerthimuvva52 wants to merge 1 commit into
masterfrom
PSIRT_8456
Closed

Fix for PSIRT PTK0008456#468
keerthimuvva52 wants to merge 1 commit into
masterfrom
PSIRT_8456

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

This PR introduces additional deserialization-time validation for Rose/LimEx bytecode to mitigate a reported PSIRT issue (PTK0008456) by preventing out-of-bounds access during scan-time execution.

Changes:

  • Added db_validate_limex_reach_map() to validate LimEx reachMap[]/reachSize metadata.
  • Integrated the new LimEx reachMap 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 +318 to +337
const char *limex_base = (const char *)getImplNfa(nfa);
u32 limex_len = nfa->length - (u32)sizeof(struct NFA);

/* Ensure we can read reachMap[256] and reachSize. */
const u32 reach_prefix_end =
(u32)(N_CHARS + sizeof(u32)); /* reachMap + reachSize */
if (unlikely(limex_len < reach_prefix_end)) {
DEBUG_PRINTF("LimEx[%u] too small for reachMap\n", qi);
return HS_INVALID;
}

const struct LimExNFA32 *limex =
(const struct LimExNFA32 *)limex_base;
const u32 reachSize = limex->reachSize;

if (unlikely(reachSize == 0)) {
DEBUG_PRINTF("LimEx[%u] reachSize is zero\n", qi);
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