fix: use a larger maxChunk size when using 64-bit platforms #126
No reviewers
Labels
No labels
breaking-change
bug
dependencies
duplicate
enhancement
go
good first issue
help wanted
invalid
investigation
proposal
proposal-accepted
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nemith/netconf!126
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "brb/push-prkxnwkmomtv"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Minor fix. the size returned from an
io.Writeris an signedintwhich limits how much we can write on 32-bit platforms (2GB) so limit it usingMath.MaxIntIn practice no client is sending 2+GB over NETCONF...hopefully.
Pull request overview
This PR addresses platform-specific limitations in chunked framing by adjusting the maximum chunk size to be architecture-aware. Instead of capping at MaxInt32 (~2GB) on all platforms, the code now uses MaxInt which allows for larger chunks on 64-bit systems while maintaining safety on 32-bit systems.
Key Changes:
min()function for cleaner code💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@ -336,0 +336,4 @@// maxChunkSize is the maximum chunk size for RFC 6242 chunked framing.// RFC 6242 allows up to MaxUint32 (4294967295), but on 32-bit systems// slice lengths are limited to MaxInt32. We use the minimum of both// to ensure compatibility across all architectures.The comment states "slice lengths are limited to MaxInt32" but this is only accurate for 32-bit systems. On 64-bit systems, slice lengths can be up to MaxInt (which is MaxInt64 on 64-bit platforms). The comment should clarify that the limit is MaxInt32 on 32-bit systems and MaxInt64 on 64-bit systems, or simply state that slice lengths are limited to MaxInt (which is architecture-dependent).