[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] crash when function that is called from tcc compiled
From: |
Jacek Wielemborek |
Subject: |
Re: [Tinycc-devel] crash when function that is called from tcc compiled dynamic library, throws exception |
Date: |
Tue, 15 Sep 2015 13:21:30 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
W dniu 15.09.2015 o 11:38, Stephan Beal pisze:
> On Tue, Sep 15, 2015 at 11:25 AM, Tigran Grigoryan <
> address@hidden> wrote:
>
>> When linux shared object (compiled with tcc) calls some c++ function, that
>> throws exception, application crashes.
>> Seems that std::terminate is called from __cxa_throw ().
>>
>> Is this something expected? (if "so" is compiled with llvm or gcc C
>> compiler it works ok)
>>
>
> Behaviour of a C app which allows a C++ exception to propagate through it
> is UNDEFINED. So, yes, what you're seeing is, in a sense, expected.
>
> C code has no way of handling an exception, and a C++ app which does not
> catch an exception crashes.
A crash isn't good behavior anyway. There's the risk that it's a memory
error leading to a security vulnerability - and compiling source code
can be a real attack vector.
signature.asc
Description: OpenPGP digital signature