Skip to content

Commit c01d65a

Browse files
committed
Check for overflow with int64 in retries
Signed-off-by: Javi Fontan <[email protected]>
1 parent f661bf5 commit c01d65a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

amqp/amqp.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package amqp
22

33
import (
44
"fmt"
5+
"math"
56
"os"
67
"strings"
78
"sync"
@@ -634,7 +635,11 @@ func fromDelivery(d *amqp.Delivery) (*queue.Job, error) {
634635
j.Retries = int32(r)
635636

636637
case int64:
637-
j.Retries = int32(r)
638+
if r <= math.MaxInt32 {
639+
j.Retries = int32(r)
640+
} else {
641+
j.Retries = 0
642+
}
638643

639644
default:
640645
err = d.Reject(false)

0 commit comments

Comments
 (0)