diff --git a/src/rose/program_runtime.h b/src/rose/program_runtime.h index 8f4c528d..7172f6aa 100644 --- a/src/rose/program_runtime.h +++ b/src/rose/program_runtime.h @@ -41,6 +41,7 @@ #include "miracle.h" #include "report.h" #include "rose.h" +#include "rose_common.h" #include "rose_internal.h" #include "rose_program.h" #include "rose_types.h" @@ -1501,6 +1502,7 @@ hwlmcb_rv_t roseRunProgram_i(const struct RoseEngine *t, DEBUG_PRINTF("program=%u, offsets [%llu,%llu], flags=%u\n", programOffset, som, end, prog_flags); + assert(programOffset != ROSE_INVALID_PROG_OFFSET); assert(programOffset >= sizeof(struct RoseEngine)); assert(programOffset < t->size); diff --git a/src/rose/rose_build_impl.h b/src/rose/rose_build_impl.h index 9eba29f0..8748a08c 100644 --- a/src/rose/rose_build_impl.h +++ b/src/rose/rose_build_impl.h @@ -31,6 +31,7 @@ #include "rose_build.h" #include "rose_build_util.h" +#include "rose_common.h" #include "rose_graph.h" #include "nfa/mpvcompile.h" #include "nfa/goughcompile.h" @@ -441,8 +442,8 @@ struct LitFragment { : fragment_id(fragment_id_in), groups(groups_in) {} u32 fragment_id; rose_group groups; - u32 lit_program_offset = 0; - u32 delay_program_offset = 0; + u32 lit_program_offset = ROSE_INVALID_PROG_OFFSET; + u32 delay_program_offset = ROSE_INVALID_PROG_OFFSET; }; // Concrete impl class diff --git a/src/rose/rose_common.h b/src/rose/rose_common.h index 3249f0b8..c0250aa5 100644 --- a/src/rose/rose_common.h +++ b/src/rose/rose_common.h @@ -41,4 +41,7 @@ /** \brief Length in bytes of a reach bitvector, used by the lookaround code. */ #define REACH_BITVECTOR_LEN 32 +/** \brief Value used to represent an invalid Rose program offset. */ +#define ROSE_INVALID_PROG_OFFSET 0 + #endif // ROSE_COMMON_H