Skip to content

Commit db5f183

Browse files
committed
Fix negative flag value wrapping in execution results command
Add validation to ensure limit and offset flags are non-negative before casting to unsigned types. This prevents negative values from wrapping to large positive numbers (e.g., uint64(-1) = 18446744073709551615).
1 parent c9274b4 commit db5f183

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

cmd/execution/results.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ func runResults(cmd *cobra.Command, args []string) error {
3030
limit, _ := cmd.Flags().GetInt("limit")
3131
offset, _ := cmd.Flags().GetInt("offset")
3232

33+
if limit < 0 {
34+
return fmt.Errorf("limit must be non-negative, got %d", limit)
35+
}
36+
if offset < 0 {
37+
return fmt.Errorf("offset must be non-negative, got %d", offset)
38+
}
39+
3340
opts := models.ResultOptions{}
3441
if limit > 0 || offset > 0 {
3542
opts.Page = &models.ResultPageOption{

0 commit comments

Comments
 (0)