Skip to content

Commit

Permalink
fix(macro processor): set max macro processing depth to 256
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperFola committed Jul 7, 2024
1 parent 8d49e31 commit c1c39c6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/Ark/Constants.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace Ark
// Default features for the VM x Compiler x Parser
constexpr uint16_t DefaultFeatures = FeatureRemoveUnusedVars | FeatureShowWarnings;

constexpr std::size_t MaxMacroProcessingDepth = 1024; ///< Controls the number of recursive calls to MacroProcessor::processNode
constexpr std::size_t MaxMacroProcessingDepth = 256; ///< Controls the number of recursive calls to MacroProcessor::processNode
constexpr std::size_t MaxMacroUnificationDepth = 256; ///< Controls the number of recursive calls to MacroProcessor::unify
constexpr std::size_t VMStackSize = 8192;
}
Expand Down
2 changes: 1 addition & 1 deletion src/arkreactor/Compiler/Macros/Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,6 @@ namespace Ark::internal

void MacroProcessor::throwMacroProcessingError(const std::string& message, const Node& node)
{
throw CodeError(message, node.filename(), node.line(), node.col(), ""); // node.repr()
throw CodeError(message, node.filename(), node.line(), node.col(), node.repr());
}
}
2 changes: 1 addition & 1 deletion tests/errors/macros/max_depth.expected
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
At / @ 1:0
Max recursion depth reached (1024). You most likely have a badly defined recursive macro calling itself without a proper exit condition
Max recursion depth reached (256). You most likely have a badly defined recursive macro calling itself without a proper exit condition

0 comments on commit c1c39c6

Please sign in to comment.