[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Assertion Failed
From: |
Michael Matz |
Subject: |
Re: [Tinycc-devel] Assertion Failed |
Date: |
Fri, 12 Feb 2021 23:54:58 +0100 (CET) |
User-agent: |
Alpine 2.21 (LSU 202 2017-01-01) |
Hello,
On Thu, 11 Feb 2021, Zhuo Zhang wrote:
I find there is an assertion failure in current tcc code.
$ cat poc.c
int a = b(c() * 1e678);
$ ./tcc -c poc.c
test.c:1: warning: implicit declaration of function 'b'
test.c:1: warning: implicit declaration of function 'c'
tcc: x86_64-gen.c:530: load: Assertion `(v >= TREG_XMM0) && (v <= TREG_XMM7)'
failed.
[1] 6773 abort (core dumped) /root/git/test_tinycc/tcc -c test.c
The abort is fine. We could replace it with a different error message,
but it would remain an error; the input simply is fuzzed nonsense.
Note for future fuzzing: a core dump due to an abort is actually a
good sign, it's not similar to e.g. a core dump due to a segfault (hinting
at random memory overwrites or suchlike, which could potentially be
abused). The abort due to an assert means that someone thought and
explicitely tested for situations which shouldn't occur, exactly so that
further problems downstream can't materialize.
So: assert --> fine, segfault --> potentially interesting.
Ciao,
Michael.