Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replacing eval()s to avoid 'eval injection' and improve HHVM Repo Author... #8

Merged
merged 3 commits into from
Jun 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Services/Math/classes/ReleaseInfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php /*

Versions:

TODO

Patches:

Services/Math/classes/class.EvalMath.php, line 344
patch for hhvm RepoAuthoritative Mode: eval() replaced PR#8

*/
2 changes: 1 addition & 1 deletion Services/Math/classes/class.EvalMath.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ function pfx($tokens, $vars = array()) {
if (is_null($op1 = $stack->pop())) return $this->trigger("internal error");
$fnn = preg_replace("/^arc/", "a", $fnn); // for the 'arc' trig synonyms
if ($fnn == 'ln') $fnn = 'log';
eval('$stack->push(' . $fnn . '($op1));'); // perfectly safe eval()
$stack->push($fnn($op1)); // 'eval()' can be easily avoided here
} elseif (array_key_exists($fnn, $this->f)) { // user function
// get args
$args = array();
Expand Down
2 changes: 1 addition & 1 deletion Services/PEAR/lib/PEAR.php
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ function PEAR_Error($message = 'unknown error', $code = null,
}
if ($this->mode & PEAR_ERROR_EXCEPTION) {
trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING);
eval('$e = new Exception($this->message, $this->code);throw($e);');
$e = new Exception($this->message, $this->code);throw($e); // no eval() necessary to throw an exception
}
}

Expand Down
3 changes: 3 additions & 0 deletions Services/PEAR/lib/ReleasesInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,8 @@
MDB2/Driver/mysqli.php, line 425
patch for hhvm usage

Services/PEAR/lib/PEAR.php, line 917
patch for hhvm RepoAuthoritative Mode: eval() replaced PR#8

*/
?>