fiber/readonly.go
RW fe1bf4a0b3
feat(ctx): add conditional copy helpers (#3703)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-08-26 07:54:15 +02:00

19 lines
463 B
Go

package fiber
import (
"unsafe"
)
//go:linkname runtimeRodata runtime.rodata
var runtimeRodata byte
//go:linkname runtimeErodata runtime.erodata
var runtimeErodata byte
func isReadOnly(p unsafe.Pointer) bool {
start := uintptr(unsafe.Pointer(&runtimeRodata)) //nolint:gosec // converting runtime symbols
end := uintptr(unsafe.Pointer(&runtimeErodata)) //nolint:gosec // converting runtime symbols
addr := uintptr(p)
return addr >= start && addr < end
}