../src/con4m/numbers.c:268:5: runtime error: load of value 94, which is not a valid value for type 'bool'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/con4m/numbers.c:268:5 in
Conditional jump or move depends on uninitialised value(s)
at 0x1751B8: i64_parse (numbers.c:268)
by 0x197C49: c4m_parse_simple_lit (literals.c:268)
by 0x1D85BD: simple_lit (parse.c:889)
by 0x1DCA45: literal (parse.c:2571)
by 0x1DE039: expression_start (parse.c:3172)
by 0x1DF2D4: expression (parse.c:3727)
by 0x1DB977: optional_initializer (parse.c:2038)
by 0x1DBA3A: symbol_info (parse.c:2069)
by 0x1DC063: variable_decl (parse.c:2277)
by 0x1E047E: module (parse.c:4064)
by 0x1E109F: c4m_parse (parse.c:4292)
by 0x1CC93F: c4m_initial_load_one (compile.c:624)
Uninitialised value was created by a stack allocation
at 0x1750F8: i64_parse (numbers.c:267)
With:
jtv/cases
)and
basic15.c4m
:https://github.com/crashappsec/libcon4m/blob/e9470ab7863c423e0729a5e26466153fa7f6685c/tests/basic15.c4m#L4-L15
the test fails, because it outputs 0 rather than 4:
It looks like this is due to incorrect handling of hex literals, as the following diff makes the test pass:
That's the same number in decimal:
Alternatively, this diff also works on my machine:
It looks like the problem is here:
https://github.com/crashappsec/libcon4m/blob/e9470ab7863c423e0729a5e26466153fa7f6685c/src/con4m/numbers.c#L262-L269