WerWolv / WerWolv/PatternLanguage

Crash When Applying Color Attribute with Void Function

Open
#183 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
275
Forks
75
Avg merge
1d 22h
Merged PRs (30d)
10

Description

The following code causes ImHex to crash when the color attribute is used with a void function:

fn void(auto t) {
};

struct Struct{
    u32 field [[color(void(1))]];
};

Struct var@ 0;
Thread 4 Crashed:: Evaluating...
0   libsystem_kernel.dylib        	    0x7ff806192826 __pthread_kill + 10
1   libsystem_pthread.dylib       	    0x7ff8061ceb5a pthread_kill + 259
2   libsystem_c.dylib             	    0x7ff8060df376 abort + 126
3   libc++abi.1.0.dylib           	       0x105739a23 abort_message + 195
4   libc++abi.1.0.dylib           	       0x105717179 demangling_terminate_handler() + 233
5   libc++abi.1.0.dylib           	       0x105737e76 std::__terminate(void (*)()) + 6
6   libc++abi.1.0.dylib           	       0x105737e18 std::terminate() + 56
7   libimhex.1.37.4.dylib         	       0x1063ddc04 void std::__1::__destroy_at[abi:se190107]<std::jthread, 0>(std::jthread*) + 196
8   libimhex.1.37.4.dylib         	       0x1063db2bc hex::TaskManager::exit() + 252
9   imhex                         	       0x1052e3840 hex::init::prepareExit() + 32
10  imhex                         	       0x1052e4d00 hex::init::runExitTasks() + 112
11  imhex                         	       0x1052b25c0 hex::crash::signalHandler(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 384
12  imhex                         	       0x1052b23e6 hex::crash::setupCrashHandlers()::$_0::__invoke(int) + 86
13  libsystem_platform.dylib      	    0x7ff8061d937d _sigtramp + 29
14  ???                           	    0x60000031c500 ???
15  libimhex.1.37.4.dylib         	       0x105ee824f pl::core::ast::applyTypeAttributes(pl::core::Evaluator*, pl::core::ast::ASTNode const*, std::__1::shared_ptr<pl::ptrn::Pattern> const&) + 6767
16  libimhex.1.37.4.dylib         	       0x105eebc88 pl::core::ast::applyVariableAttributes(pl::core::Evaluator*, pl::core::ast::ASTNode const*, std::__1::shared_ptr<pl::ptrn::Pattern> const&) + 184
17  libimhex.1.37.4.dylib         	       0x105f4e9b1 wolv::util::scope_guard::ScopeGuard<pl::core::ast::ASTNodeVariableDecl::createPatterns(pl::core::Evaluator*, std::__1::vector<std::__1::shared_ptr<pl::ptrn::Pattern>, std::__1::allocator<std::__1::shared_ptr<pl::ptrn::Pattern>>>&) const::$_4>::~ScopeGuard() + 209
18  libimhex.1.37.4.dylib         	       0x105f4e431 pl::core::ast::ASTNodeVariableDecl::createPatterns(pl::core::Evaluator*, std::__1::vector<std::__1::shared_ptr<pl::ptrn::Pattern>, std::__1::allocator<std::__1::shared_ptr<pl::ptrn::Pattern>>>&) const + 641
19  libimhex.1.37.4.dylib         	       0x105f423f6 pl::core::ast::ASTNodeStruct::createPatterns(pl::core::Evaluator*, std::__1::vector<std::__1::shared_ptr<pl::ptrn::Pattern>, std::__1::allocator<std::__1::shared_ptr<pl::ptrn::Pattern>>>&) const + 1270
20  libimhex.1.37.4.dylib         	       0x105f4742f pl::core::ast::ASTNodeTypeDecl::createPatterns(pl::core::Evaluator*, std::__1::vector<std::__1::shared_ptr<pl::ptrn::Pattern>, std::__1::allocator<std::__1::shared_ptr<pl::ptrn::Pattern>>>&) const + 4751
21  libimhex.1.37.4.dylib         	       0x105f4742f pl::core::ast::ASTNodeTypeDecl::createPatterns(pl::core::Evaluator*, std::__1::vector<std::__1::shared_ptr<pl::ptrn::Pattern>, std::__1::allocator<std::__1::shared_ptr<pl::ptrn::Pattern>>>&) const + 4751
22  libimhex.1.37.4.dylib         	       0x105f4e411 pl::core::ast::ASTNodeVariableDecl::createPatterns(pl::core::Evaluator*, std::__1::vector<std::__1::shared_ptr<pl::ptrn::Pattern>, std::__1::allocator<std::__1::shared_ptr<pl::ptrn::Pattern>>>&) const + 609
23  libimhex.1.37.4.dylib         	       0x105f5f5d4 pl::core::Evaluator::evaluate(std::__1::vector<std::__1::shared_ptr<pl::core::ast::ASTNode>, std::__1::allocator<std::__1::shared_ptr<pl::core::ast::ASTNode>>> const&) + 3380
24  libimhex.1.37.4.dylib         	       0x105ec0c28 pl::PatternLanguage::executeString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, pl::core::Token::Literal, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, pl::core::Token::Literal>>> const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, pl::core::Token::Literal, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, pl::core::Token::Literal>>> const&, bool) + 2472
25  builtin.hexplug               	       0x12966285f std::__1::__function::__func<hex::plugin::builtin::ViewPatternEditor::evaluatePattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, hex::prv::Provider*)::$_0, std::__1::allocator<hex::plugin::builtin::ViewPatternEditor::evaluatePattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, hex::prv::Provider*)::$_0>, void (hex::Task&)>::operator()(hex::Task&) + 1567
26  libimhex.1.37.4.dylib         	       0x1063de1e5 void* std::__1::__thread_proxy[abi:se190107]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, std::jthread::jthread<hex::TaskManager::init()::$_0, void>(hex::TaskManager::init()::$_0&&)::'lambda'(std::stop_token, hex::TaskManager::init()::$_0&&), std::stop_token, hex::TaskManager::init()::$_0>>(void*) + 1109
27  libsystem_pthread.dylib       	    0x7ff8061cee4d _pthread_start + 115
28  libsystem_pthread.dylib       	    0x7ff8061ca857 thread_start + 15|

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash with the Pattern Language snippet and start at pl::core::ast::applyTypeAttributes, identified in the stack trace, then trace how the void result from color(void(1)) is handled. Done means the example no longer crashes when a color attribute calls a void function; add or run a regression check if the repository provides one.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.