I faced problem which solved in https://github.com/VirusTotal/yara/commit/9c26038171edcdc084370562703f22e649067125
Yara rules compiled by yara64.exe don't work with yara32.exe.
I saw the problem was solved by addition field 'uint32_t unused;', but I think it is non-persistent soltuion. Adding one more uint32_t raise the probem again
It work nice.
I think there were no problems before because YR_RULE contained 2 int32_t field. Adding uint32_t required_strings caues misalining in rule loading. 'uint32_t unused;' is non-persistent soltuion, because another new field also break the loading. I suggest to move YR_ALIGN(8) to try avoid same problem in future
#define DECLARE_REFERENCE(type, name) \
YR_ALIGN(8) union \
{ \
type name; \
YR_ARENA_REF name##_; \
}
I faced problem which solved in https://github.com/VirusTotal/yara/commit/9c26038171edcdc084370562703f22e649067125 Yara rules compiled by yara64.exe don't work with yara32.exe. I saw the problem was solved by addition field 'uint32_t unused;', but I think it is non-persistent soltuion. Adding one more uint32_t raise the probem again
To Reproduce 1) simple rule. file rules.yara
2)
yarac64.exe "D:\rules.yara" d:\rules.yarac
3) 64 bit version run ok4) 32 bit version don't work
I obtain in debug mode rule_table is collapsed 5) Ubuntu compiled version run as expected for 32 and 64 bit both
Please complete the following information:
Additional context I can see problem with aligment in macro
when
According microsoft documentaion https://learn.microsoft.com/en-us/cpp/cpp/align-cpp?view=msvc-170 aling command must go before struct or union declarion. For gcc
__attribute__((aligned(n)))
can be wriiten before and after both.Using YR_ALIGN everywhere except DECLARE_REFERENCE is before struct, union. For example
It work nice. I think there were no problems before because YR_RULE contained 2 int32_t field. Adding
uint32_t required_strings
caues misalining in rule loading. 'uint32_t unused;' is non-persistent soltuion, because another new field also break the loading. I suggest to moveYR_ALIGN(8)
to try avoid same problem in future