From 182f3a9b4dff16474fbb7123466181a09781b633 Mon Sep 17 00:00:00 2001 From: borx <53216212+binorxin@users.noreply.github.com> Date: Thu, 20 Nov 2025 23:57:30 +0800 Subject: [PATCH] fix: cast size to int64 before comparing with MaxUint32 --- relay/channel/volcengine/protocols.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/relay/channel/volcengine/protocols.go b/relay/channel/volcengine/protocols.go index c978e1c76..fb7dcd578 100644 --- a/relay/channel/volcengine/protocols.go +++ b/relay/channel/volcengine/protocols.go @@ -385,7 +385,7 @@ func (m *Message) writeSessionID(buf *bytes.Buffer) error { } size := len(m.SessionID) - if size > math.MaxUint32 { + if int64(size) > math.MaxUint32 { return fmt.Errorf("session ID size (%d) exceeds max(uint32)", size) } @@ -407,7 +407,7 @@ func (m *Message) writeErrorCode(buf *bytes.Buffer) error { func (m *Message) writePayload(buf *bytes.Buffer) error { size := len(m.Payload) - if size > math.MaxUint32 { + if int64(size) > math.MaxUint32 { return fmt.Errorf("payload size (%d) exceeds max(uint32)", size) }