crashappsec / libcon4m

Base Compiler and Runtime Support for con4m
Apache License 2.0
0 stars 0 forks source link

SIGSEGV: so-called oddball literals #77

Open ee7 opened 1 week ago

ee7 commented 1 week ago

With:

c4test no longer crashes (see https://github.com/crashappsec/libcon4m/issues/54) with these:

x = 1'foo
x = "1"'foo

but it does crash for cases like these:

x = "1"'sz
x = "2024-01-01"'date
x = "https://example.com"'url

with traces like:

Invalid read of size 8
  at 0x1480AC: c4m_parse_simple_lit (../src/con4m/literals.c:274)
  by 0x16162B: simple_lit (../src/con4m/compiler/parse.c:890)
  by 0x1645DE: literal (../src/con4m/compiler/parse.c:2638)
  by 0x1660F3: expression_start (../src/con4m/compiler/parse.c:3239)
  by 0x160BF4: expression (../src/con4m/compiler/parse.c:3794)
  by 0x160C85: assign (../src/con4m/compiler/parse.c:3060)
  by 0x15E3F8: module (../src/con4m/compiler/parse.c:4222)
  by 0x15D93B: c4m_parse (../src/con4m/compiler/parse.c:4359)
  by 0x158E77: c4m_initial_load_one (../src/con4m/compiler/compile.c:624)
  by 0x158D0E: c4m_perform_module_loads (../src/con4m/compiler/compile.c:741)
  by 0x159291: c4m_compile_from_entry_point (../src/con4m/compiler/compile.c:1052)
  by 0x116D5A: test_compiler (../src/tests/test.c:427)
Address 0x48 is not stack'd, malloc'd or (recently) free'd

Process terminating with default action of signal 11 (SIGSEGV): dumping core

This is probably just not yet implemented, but let's track it here.

The literals are registered here:

https://github.com/crashappsec/libcon4m/blob/b4fdc8e2e70b0ef18a554562702e2db1e0c9aff0/src/con4m/literals.c#L147-L220

viega commented 1 week ago

Yes, I said last week those data types are not yet implemented, so this is expected.