Skip to content

Commit

Permalink
Item15192: improved fix to $EVAL()
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed May 17, 2023
1 parent c8c592a commit 82cbc46
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Expand Up @@ -1733,6 +1733,7 @@ sub _safeEvalPerl {
# disable glob for security reasons
$theText =~ s/^([\(\s]*)\<+/$1/g;
$theText =~ s/\>+([\s\)]*)$/$1/g;
$theText =~ s/\<\s*\>/ /g;

# remove leading 0s to defuse interpretation of numbers as octals
$theText =~ s/(^|[^\.])\b0+(?=[0-9])/$1/g;
Expand Down
Expand Up @@ -441,6 +441,9 @@ sub test_EVAL_GLOB {
$this->assert( $this->CALC('$EVAL((<*>))') =~ /^ERROR:/ );
$this->assert( $this->CALC('$EVAL(< * >)') =~ /^ERROR:/ );
$this->assert( $this->CALC('$EVAL(<../../../ee*/* >)') =~ /^ERROR:/ );
$this->assert( $this->CALC('$EVAL(<>)') == 0 );
$this->assert( $this->CALC('$EVAL(2+<>+2)') == 4 );
$this->assert( $this->CALC('$EVAL(2+< >+2)') == 4 );
}

sub test_EVEN {
Expand Down

0 comments on commit 82cbc46

Please sign in to comment.