crashappsec / crashappsec/libcon4m

SIGSEGV: when using `~`

Open
#58 1 comment 0 reactions 0 assignees View on GitHub
enhancement P1
Dominant language
C
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

With:

- libcon4m https://github.com/crashappsec/libcon4m/commit/14604adf6ca68c75a08360129d71beb63571c1d1
- x86_64
- Linux 6.9.6
- clang 17.0.6

The `.c4m` file:

```text
x = 1
~x
```

produces the ASan output:

```text
ERROR: AddressSanitizer: SEGV on unknown address 0x000000000004 (pc 0x5c3742234b28 bp 0x7ffd55a63d10 sp 0x7ffd55a63c70 T0)
The signal is caused by a READ memory access.
Hint: address points to the zero page.
SCARINESS: 10 (null-deref)
#0 0x5c3742234b28 in gen_one_kid libcon4m/debug/../src/con4m/compiler/codegen.c:478:16
#1 0x5c374222ff70 in gen_lock libcon4m/debug/../src/con4m/compiler/codegen.c:1783:5
#2 0x5c374221fba4 in gen_one_node libcon4m/debug/../src/con4m/compiler/codegen.c:1901:9
#3 0x5c37422241aa in gen_kids libcon4m/debug/../src/con4m/compiler/codegen.c:466:9
#4 0x5c3742223c66 in gen_module libcon4m/debug/../src/con4m/compiler/codegen.c:787:5
#5 0x5c374221f710 in gen_one_node libcon4m/debug/../src/con4m/compiler/codegen.c:1805:9
#6 0x5c374221df59 in gen_module_code libcon4m/debug/../src/con4m/compiler/codegen.c:2110:5
#7 0x5c374221b383 in c4m_internal_codegen libcon4m/debug/../src/con4m/compiler/codegen.c:2188:9
#8 0x5c3742174cb6 in c4m_generate_code libcon4m/debug/../src/con4m/compiler/compile.c:1079:5
#9 0x5c374200e63f in test_compiler libcon4m/debug/../src/tests/test.c:441:20
```

and e.g.:

```text
~foo.bar = 1
```

produces:

```text
ERROR: AddressSanitizer: SEGV on unknown address (pc 0x5cf9ab39cedb bp 0x7ffc0e587510 sp 0x7ffc0e587180 T0)
The signal is caused by a READ memory access.
Hint: this fault was caused by a dereference of a high value address.
SCARINESS: 20 (wild-addr-read)
#0 0x5cf9ab39cedb in hatrack_dict_get_hash_value libcon4m/debug/../src/hatrack/hash/dict.c:682:14
#1 0x5cf9ab39bb8c in hatrack_dict_get_mmm libcon4m/debug/../src/hatrack/hash/dict.c:205:10
#2 0x5cf9ab39dadc in hatrack_dict_get libcon4m/debug/../src/hatrack/hash/dict.c:237:12
#3 0x5cf9ab40a7d5 in c4m_vm_attr_lock libcon4m/debug/../src/con4m/attrstore.c:130:37
#4 0x5cf9ab25f9f9 in c4m_vm_runloop libcon4m/debug/../src/con4m/vm.c:1127:21
#5 0x5cf9ab24c4f9 in c4m_vmthread_run libcon4m/debug/../src/con4m/vm.c:1664:18
#6 0x5cf9ab161919 in test_compiler libcon4m/debug/../src/tests/test.c:453:5
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.