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

Follow up, Fix Integer Overflow #666

Merged
merged 1 commit into from
Sep 2, 2024
Merged
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
6 changes: 5 additions & 1 deletion internal/runner/nomad_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"errors"
"fmt"
"io"
"math"
"net/http"
"strings"
"time"
Expand Down Expand Up @@ -299,8 +300,11 @@
stdin io.ReadWriter, stdout, stderr io.Writer, exit chan<- ExitInfo,
) {
exitCode, err := r.api.ExecuteCommand(ctx, r.id, command, true, privilegedExecution, stdin, stdout, stderr)
if exitCode > math.MaxUint8 {
log.WithContext(ctx).WithError(err).WithField("exit_code", exitCode).Error("exitCode too big")

Check warning on line 304 in internal/runner/nomad_runner.go

View check run for this annotation

Codecov / codecov/patch

internal/runner/nomad_runner.go#L304

Added line #L304 was not covered by tests
}
select {
case exit <- ExitInfo{uint8(exitCode), err}:
case exit <- ExitInfo{uint8(exitCode), err}: //nolint:gosec // We check for an integer overflow right above.
case <-ctx.Done():
}
}
Expand Down
Loading