-
Notifications
You must be signed in to change notification settings - Fork 45
Description
Describe the bug
Hello,
In the following example, compiler parser segfaults if tokenRingBufferPeek()
returns NULL.
U0 Main() {
/*
}
A debug build (address sanitizer enabled), it points to cctrlTokenPeek(), which calls tokenRingBufferPeek() and it returns a NULL pointer. Functions that call ccttrlTokenPeek(), doesn't handle it's return value, and tries to dereference the NULL pointer.
I don't know why ring_buffer size is 0 (if /*
doesn't end with */
), I assume ring buffer is just keep popping and it doesn't see that we didn't end the comment line.
To Reproduce
Steps to reproduce the behavior:
- Compile the following example program.
Example Program
U0 Main() {
/*
}
Expected behavior
No error at all.
Compiler version
hcc beta-v0.0.9
binary: /usr/local/hcc
commit-hash: fd2d410
arch: Linux x86_64
build: Debug
Desktop (please complete the following information):
- OS: N/A