fishy commented on code in PR #3873:
URL: https://github.com/apache/thrift/pull/3873#discussion_r4031140756
##########
lib/go/thrift/framed_transport.go:
##########
@@ -202,11 +202,14 @@ func (p *TFramedTransport) WriteString(s string) (n int,
err error) {
func (p *TFramedTransport) Flush(ctx context.Context) error {
size := p.writeBuf.Len()
- if uint64(size) > uint64(math.MaxUint32) {
- return NewTTransportException(UNKNOWN_TRANSPORT_EXCEPTION,
fmt.Sprintf("frame too large: %d bytes exceeds uint32 max", size))
- }
-
defer bufPool.put(&p.writeBuf)
+
+ // readFrame refuses a frame larger than the configured maximum, and so
does
+ // a peer holding the same configuration. The maximum is below what the
+ // 32-bit length can carry. A refused frame is dropped with the buffer.
+ if maxSize := p.cfg.GetMaxFrameSize(); int64(size) > int64(maxSize) {
Review Comment:
should we reuse the same helper in THeader implementation? in that helper we
also checked against `MaxUint32` which we didn't do here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]