Browse Source

prevent stack copy

pull/1435/head
Darien Raymond 6 years ago
parent
commit
bd7bc63fac
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
  1. 1
      common/protocol/address.go
  2. 3
      common/serial/serial.go

1
common/protocol/address.go

@ -226,6 +226,7 @@ func (p *addressParser) readAddress(b *buf.Buffer, reader io.Reader) (net.Addres
}
}
//go:nosplit
func (p *addressParser) writeAddress(writer io.Writer, address net.Address) error {
tb := p.addrByteMap[address.Family()]
if tb == afInvalid {

3
common/serial/serial.go

@ -9,6 +9,7 @@ import (
)
// ReadUint16 reads first two bytes from the reader, and then coverts them to an uint16 value.
//go:nosplit
func ReadUint16(reader io.Reader) (uint16, error) {
var b stack.TwoBytes
s := b[:]
@ -22,6 +23,7 @@ func ReadUint16(reader io.Reader) (uint16, error) {
}
// WriteUint16 writes an uint16 value into writer.
//go:nosplit
func WriteUint16(writer io.Writer, value uint16) (int, error) {
var b stack.TwoBytes
s := b[:]
@ -33,6 +35,7 @@ func WriteUint16(writer io.Writer, value uint16) (int, error) {
}
// WriteUint64 writes an uint64 value into writer.
//go:nosplit
func WriteUint64(writer io.Writer, value uint64) (int, error) {
var b stack.EightBytes
s := b[:]

Loading…
Cancel
Save