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

[BUG] SupertaskUtils::runSupertask fails if pretask CrackerBinaryType to provided $crackerBinaryType #969

Closed
rixvet opened this issue Aug 24, 2023 · 0 comments · Fixed by #971
Assignees
Labels
bug Something isn't working server Hashtopolis API/Server related

Comments

@rixvet
Copy link
Collaborator

rixvet commented Aug 24, 2023

Current Behavior
Calling SupertaskUtils::runSupertask with pretask where CrackerBinaryType is not equal to $crackerId BinaryType will cause an error "Object of class DBA\CrackerBinary could not be converted to string"

Expected Behavior
function exectutes with error

Background
There are conditional statement if ($cracker->getCrackerBinaryTypeId() != $pretask->getCrackerBinaryTypeId()) {
which triggers an object returned instead of an Id.

Additional information
a) PoC fix

diff --git a/src/inc/utils/SupertaskUtils.class.php b/src/inc/utils/SupertaskUtils.class.php
index 004fb1cb..b4276577 100644
--- a/src/inc/utils/SupertaskUtils.class.php
+++ b/src/inc/utils/SupertaskUtils.class.php
@@ -278,7 +278,7 @@ class SupertaskUtils {
     foreach ($pretasks as $pretask) {
       $crackerBinaryId = $cracker->getId();
       if ($cracker->getCrackerBinaryTypeId() != $pretask->getCrackerBinaryTypeId()) {
-        $crackerBinaryId = CrackerBinaryUtils::getNewestVersion($pretask->getCrackerBinaryTypeId());
+        $crackerBinaryId = CrackerBinaryUtils::getNewestVersion($pretask->getCrackerBinaryTypeId())->getId();
       }

       $task = new Task(
@rixvet rixvet added bug Something isn't working server Hashtopolis API/Server related labels Aug 24, 2023
rixvet added a commit that referenced this issue Aug 28, 2023
Instead of returning an object, it  should return an ID instead.

Fixes: #969
@zyronix zyronix self-assigned this Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working server Hashtopolis API/Server related
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants