File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 55 "bytes"
66 "fmt"
77 "io"
8+ "math"
89 "strconv"
910 "sync"
1011)
@@ -115,7 +116,7 @@ func (e *PayloadEncoder) EncodeTo(w io.Writer) error {
115116 return nil
116117}
117118
118- //IsString returns true if payload encode to string, otherwise returns false.
119+ // IsString returns true if payload encode to string, otherwise returns false.
119120func (e * PayloadEncoder ) IsString () bool {
120121 return e .isString
121122}
@@ -166,5 +167,10 @@ func (d *PayloadDecoder) Next() (*PacketDecoder, error) {
166167 if err != nil {
167168 return nil , fmt .Errorf ("invalid input" )
168169 }
170+
171+ if packetLen > math .MaxInt || packetLen < math .MinInt {
172+ return nil , fmt .Errorf ("invalid input" )
173+ }
174+
169175 return NewDecoder (newLimitReader (d .r , int (packetLen )))
170176}
You can’t perform that action at this time.
0 commit comments