qorelanguage / qore

Qore Programming Language
GNU General Public License v2.0
58 stars 10 forks source link

error handling data registered in foreign modules in module init methods #4816

Open davidnich opened 9 months ago

davidnich commented 9 months ago

if an exception is thrown, the module is deleted, but data could be left in foreign modules, resulting in a crash when it's accessed - ex:

* thread #1, name = 'qore/1', queue = 'com.apple.main-thread', stop reason = signal SIGSEGV
  * frame #0: 0x00000001015dee38 libqore.12.dylib`std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::__is_long[abi:v15006](this="") const at string:1499:33
    frame #1: 0x000000010141e990 libqore.12.dylib`std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::size[abi:v15006](this="") const at string:968:17
    frame #2: 0x000000010137d838 libqore.12.dylib`bool std::__1::operator==[abi:v15006]<std::__1::allocator<char>>(__lhs="", __rhs="DataProviderAppInfo") at string:4164:29
    frame #3: 0x0000000101373a84 libqore.12.dylib`bool std::__1::operator!=[abi:v15006]<char, std::__1::char_traits<char>, std::__1::allocator<char>>(__lhs="", __rhs="DataProviderAppInfo") at string:4209:20
    frame #4: 0x00000001014e9f6c libqore.12.dylib`typed_hash_decl_private::equal(this=0x776f6c666b726f77, other=0x0000000100bda600) const at typed_hash_decl_private.h:103:18
    frame #5: 0x00000001014e9410 libqore.12.dylib`QoreTypeSpec::acceptInput(this=0x0000000100bdad70, xsink=0x000000016fdfe780, typeInfo=0x0000000100bdaa70, map=q_type_map_t @ 0x000000016fdf5008, arg_type="lvalue", obj=false, param_num=-1, param_name="<lvalue>", n=0x000000016fdf51f8, lvhelper=0x0000000000000000) const at QoreTypeInfo.cpp:1170:62
    frame #6: 0x00000001014ea278 libqore.12.dylib`QoreTypeInfo::acceptInputIntern(this=0x0000000100bdaa70, xsink=0x000000016fdfe780, arg_type="lvalue", obj=false, param_num=-1, param_name="<lvalue>", n=0x000000016fdf51f8, lvhelper=0x0000000000000000) const at QoreTypeInfo.h:1050:24
    frame #7: 0x00000001013113dc libqore.12.dylib`QoreTypeInfo::acceptAssignment(ti=0x0000000100bdaa70, text="<lvalue>", n=0x000000016fdf51f8, xsink=0x000000016fdfe780, lvhelper=0x000000016fdf5218) at QoreTypeInfo.h:718:17
    frame #8: 0x00000001013076f8 libqore.12.dylib`LValueHelper::assign(this=0x000000016fdf5218, n=QoreValue @ 0x000000016fdf51f8, desc="<lvalue>", check_types=true, weak_assignment=false) at Variable.cpp:736:9
    frame #9: 0x00000001014ff68c libqore.12.dylib`QoreAssignmentOperatorNode::evalIntern(this=0x000000010270b850, xsink=0x000000016fdfe780, needs_deref=0x000000016fdf5548, weak_assignment=false) const at QoreAssignmentOperatorNode.cpp:158:11
    frame #10: 0x00000001015b9298 libqore.12.dylib`QoreAssignmentOperatorNode::evalImpl(this=0x000000010270b850, needs_deref=0x000000016fdf5548, xsink=0x000000016fdfe780) const at QoreAssignmentOperatorNode.h:60:16
    frame #11: 0x00000001012def9c libqore.12.dylib`AbstractQoreNode::eval(this=0x000000010270b850, needs_deref=0x000000016fdf5548, xsink=0x000000016fdfe780) const at AbstractQoreNode.cpp:172:20
...