WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
6961c37
[release-branch.go1.25] database/sql: avoid closing Rows while scan i…
neild Jul 23, 2025
ac94297
[release-branch.go1.25] go1.25rc3
gopherbot Aug 6, 2025
6e676ab
[release-branch.go1.25] go1.25.0
gopherbot Aug 12, 2025
c72fcab
[release-branch.go1.25] cmd/go/internal/gover: fix ModIsPrerelease fo…
matloob Jul 29, 2025
21ac81c
[release-branch.go1.25] os/exec: fix incorrect expansion of ".." in L…
millerresearch Aug 7, 2025
749dff8
[release-branch.go1.25] runtime: make all synctest bubble violations …
neild Aug 14, 2025
8995e84
[release-branch.go1.25] internal/poll: set the correct file offset in…
qmuntal Aug 19, 2025
cdd8cf4
[release-branch.go1.25] net: fix WriteMsgUDPAddrPort addr handling on…
database64128 Jul 25, 2025
b1959cf
[release-branch.go1.25] net/http: require exact match for CrossSitePr…
FiloSottile Aug 26, 2025
56ebf80
[release-branch.go1.25] go1.25.1
gopherbot Sep 3, 2025
879e3cb
[release-branch.go1.25] runtime: lock mheap_.speciallock when allocat…
neild Aug 26, 2025
a86792b
[release-branch.go1.25] net: skip TestIPv4WriteMsgUDPAddrPort on plan9
millerresearch Aug 14, 2025
be61132
[release-branch.go1.25] cmd/compile: export to DWARF types only refer…
aarzilli Aug 18, 2025
7d57009
[release-branch.go1.25] os: fix Root.MkdirAll to handle race of direc…
database64128 Aug 21, 2025
f75bcff
[release-branch.go1.25] os: set full name for Roots created with Root…
neild Aug 22, 2025
57bd28a
[release-branch.go1.25] crypto/internal/fips140/ecdsa: make TestingOn…
FiloSottile Sep 7, 2025
bec452a
[release-branch.go1.25] crypto/internal/fips140: update frozen module…
FiloSottile Sep 10, 2025
90de3b3
[release-branch.go1.25] crypto/internal/fips140: remove key import PC…
FiloSottile Sep 5, 2025
b816c79
[release-branch.go1.25] lib/fips140: re-seal v1.0.0
FiloSottile Sep 7, 2025
79c3081
[release-branch.go1.25] internal/poll: don't call Seek for overlapped…
qmuntal Aug 19, 2025
f3dc4aa
[release-branch.go1.25] runtime: initialise debug settings much earli…
9muir Sep 18, 2025
16fdaac
[release-branch.go1.25] sync/atomic: correct Uintptr.Or return doc
prattmic Sep 25, 2025
205d086
[release-branch.go1.25] crypto/tls: quote protocols in ALPN error mes…
rolandshoemaker Sep 29, 2025
7735dc9
[release-branch.go1.25] cmd/compile: don't rely on loop info when the…
randall77 Sep 23, 2025
0b53e41
[release-branch.go1.25] debug/pe: permit symbols with no name
ianlancetaylor Sep 1, 2025
06993c7
[release-branch.go1.25] context: don't return a non-nil from Err befo…
neild Sep 18, 2025
28ac8d2
[release-branch.go1.25] net/http: avoid connCount underflow race
neild Sep 15, 2025
d6f2741
[release-branch.go1.25] spec: update spec date to match release date
Oct 6, 2025
66f6fea
[release-branch.go1.25] spec: revert "update spec date to match relea…
Oct 6, 2025
6a05732
[release-branch.go1.25] net/mail: avoid quadratic behavior in mail ad…
neild Sep 25, 2025
930ce22
[release-branch.go1.25] crypto/x509: mitigate DoS vector when interme…
thatnealpatel Sep 11, 2025
5d7a787
[release-branch.go1.25] net/textproto: avoid quadratic complexity in …
neild Sep 30, 2025
9fd3ac8
[release-branch.go1.25] net/url: enforce stricter parsing of brackete…
ethanalee-work Aug 29, 2025
f0c69db
[release-branch.go1.25] crypto/x509: improve domain name verification
thatnealpatel Sep 15, 2025
100c5a6
[release-branch.go1.25] net/http: add httpcookiemaxnum GODEBUG option…
nicholashusin Sep 30, 2025
e0f655b
[release-branch.go1.25] encoding/asn1: prevent memory exhaustion when…
nicholashusin Sep 3, 2025
90f72bd
[release-branch.go1.25] encoding/pem: make Decode complexity linear
rolandshoemaker Sep 30, 2025
2612dcf
[release-branch.go1.25] archive/tar: set a limit on the size of GNU s…
neild Sep 11, 2025
bed6c81
[release-branch.go1.25] go1.25.2
gopherbot Oct 7, 2025
79ec0c9
[release-branch.go1.25] spec: update spec date to match release date
Oct 6, 2025
e05b2c9
[release-branch.go1.25] crypto/x509: rework fix for CVE-2025-58187
rolandshoemaker Oct 9, 2025
28622c1
[release-branch.go1.25] go1.25.3
gopherbot Oct 13, 2025
f6db735
[release-branch.go1.25] net/url: allow IP-literals with IPv4-mapped I…
rolandshoemaker Oct 9, 2025
7e049e5
[release-branch.go1.25] encoding/pem: properly decode strange PEM data
rolandshoemaker Oct 15, 2025
bbb7627
[release-branch.go1.25] cmd/compile: prevent shapifying of pointer sh…
cuonglm Sep 15, 2025
bf95b76
[release-branch.go1.25] runtime: use one more address bit for tagged …
randall77 Sep 2, 2025
cd21a7b
[release-branch.go1.25] Revert "crypto/internal/fips140/subtle: add a…
randall77 Oct 7, 2025
4942c74
[release-branch.go1.25] Revert "crypto/internal/fips140/subtle: add a…
randall77 Oct 7, 2025
8097b19
[release-branch.go1.25] os: support deleting read-only files in Remov…
qmuntal Oct 21, 2025
5ba37a3
[release-branch.go1.25] cmd/compile: don't optimize away a panicing i…
randall77 Oct 22, 2025
83885f3
[release-branch.go1.25] encoding/pem: properly calculate end indexes
rolandshoemaker Oct 23, 2025
f2cd93a
[release-branch.go1.25] go1.25.4
gopherbot Nov 5, 2025
433c01e
[release-branch.go1.25] internal/syscall/windows: fix ReOpenFile sent…
qmuntal Nov 3, 2025
e1ce1bf
[release-branch.go1.25] mime: parse media types that contain braces
jub0bs Nov 10, 2025
287017a
[release-branch.go1.25] crypto/x509: excluded subdomain constraints p…
rolandshoemaker Nov 24, 2025
f7bce4b
[release-branch.go1.25] crypto/x509: prevent HostnameError.Error() fr…
nicholashusin Nov 24, 2025
fefb02a
[release-branch.go1.25] go1.25.5
gopherbot Dec 2, 2025
d1438a5
cmd/cgo: fix unaligned arguments typedmemmove crash on iOS
timcooijmans Sep 30, 2025
9c9e473
version
zoom-ua Dec 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
go1.25rc2
time 2025-07-02T21:52:16Z
go1.25.5-kb
time 2025-12-18T10:09:51Z
2 changes: 1 addition & 1 deletion doc/go_spec.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
"Subtitle": "Language version go1.25 (Feb 25, 2025)",
"Subtitle": "Language version go1.25 (Aug 12, 2025)",
"Path": "/ref/spec"
}-->

Expand Down
10 changes: 10 additions & 0 deletions doc/godebug.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,16 @@ for example,
see the [runtime documentation](/pkg/runtime#hdr-Environment_Variables)
and the [go command documentation](/cmd/go#hdr-Build_and_test_caching).

### Go 1.26

Go 1.26 added a new `httpcookiemaxnum` setting that controls the maximum number
of cookies that net/http will accept when parsing HTTP headers. If the number of
cookie in a header exceeds the number set in `httpcookiemaxnum`, cookie parsing
will fail early. The default value is `httpcookiemaxnum=3000`. Setting
`httpcookiemaxnum=0` will allow the cookie parsing to accept an indefinite
number of cookies. To avoid denial of service attacks, this setting and default
was backported to Go 1.25.2 and Go 1.24.8.

### Go 1.25

Go 1.25 added a new `decoratemappings` setting that controls whether the Go
Expand Down
2 changes: 1 addition & 1 deletion lib/fips140/fips140.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
#
# go test cmd/go/internal/fips140 -update
#
v1.0.0.zip b50508feaeff05d22516b21e1fd210bbf5d6a1e422eaf2cfa23fe379342713b8
v1.0.0-c2097c7c.zip daf3614e0406f67ae6323c902db3f953a1effb199142362a039e7526dfb9368b
2 changes: 1 addition & 1 deletion lib/fips140/inprocess.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.0.0
v1.0.0-c2097c7c
Binary file not shown.
1 change: 1 addition & 0 deletions lib/fips140/v1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v1.0.0-c2097c7c
1 change: 1 addition & 0 deletions src/archive/tar/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var (
errMissData = errors.New("archive/tar: sparse file references non-existent data")
errUnrefData = errors.New("archive/tar: sparse file contains unreferenced data")
errWriteHole = errors.New("archive/tar: write non-NUL byte in sparse hole")
errSparseTooLong = errors.New("archive/tar: sparse map too long")
)

type headerError []string
Expand Down
9 changes: 7 additions & 2 deletions src/archive/tar/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,17 @@ func readGNUSparseMap1x0(r io.Reader) (sparseDatas, error) {
cntNewline int64
buf bytes.Buffer
blk block
totalSize int
)

// feedTokens copies data in blocks from r into buf until there are
// at least cnt newlines in buf. It will not read more blocks than needed.
feedTokens := func(n int64) error {
for cntNewline < n {
totalSize += len(blk)
if totalSize > maxSpecialFileSize {
return errSparseTooLong
}
if _, err := mustReadFull(r, blk[:]); err != nil {
return err
}
Expand Down Expand Up @@ -569,8 +574,8 @@ func readGNUSparseMap1x0(r io.Reader) (sparseDatas, error) {
}

// Parse for all member entries.
// numEntries is trusted after this since a potential attacker must have
// committed resources proportional to what this library used.
// numEntries is trusted after this since feedTokens limits the number of
// tokens based on maxSpecialFileSize.
if err := feedTokens(2 * numEntries); err != nil {
return nil, err
}
Expand Down
5 changes: 5 additions & 0 deletions src/archive/tar/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,11 @@ func TestReader(t *testing.T) {
},
Format: FormatPAX,
}},
}, {
// Small compressed file that uncompresses to
// a file with a very large GNU 1.0 sparse map.
file: "testdata/gnu-sparse-many-zeros.tar.bz2",
err: errSparseTooLong,
}}

for _, v := range vectors {
Expand Down
Binary file not shown.
144 changes: 144 additions & 0 deletions src/cmd/cgo/internal/testout/out_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package out_test

import (
"bufio"
"bytes"
"fmt"
"internal/testenv"
"internal/goarch"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"testing"
)

type methodAlign struct {
Method string
Align int
}

var wantAligns = map[string]int{
"ReturnEmpty": 1,
"ReturnOnlyUint8": 1,
"ReturnOnlyUint16": 2,
"ReturnOnlyUint32": 4,
"ReturnOnlyUint64": goarch.PtrSize,
"ReturnOnlyInt": goarch.PtrSize,
"ReturnOnlyPtr": goarch.PtrSize,
"ReturnByteSlice": goarch.PtrSize,
"ReturnString": goarch.PtrSize,
"InputAndReturnUint8": 1,
"MixedTypes": goarch.PtrSize,
}

// TestAligned tests that the generated _cgo_export.c file has the wanted
// align attributes for struct types used as arguments or results of
// //exported functions.
func TestAligned(t *testing.T) {
testenv.MustHaveGoRun(t)
testenv.MustHaveCGO(t)

testdata, err := filepath.Abs("testdata")
if err != nil {
t.Fatal(err)
}

objDir := t.TempDir()

cmd := testenv.Command(t, testenv.GoToolPath(t), "tool", "cgo",
"-objdir", objDir,
filepath.Join(testdata, "aligned.go"))
cmd.Stderr = new(bytes.Buffer)

err = cmd.Run()
if err != nil {
t.Fatalf("%#q: %v\n%s", cmd, err, cmd.Stderr)
}

haveAligns, err := parseAlign(filepath.Join(objDir, "_cgo_export.c"))
if err != nil {
t.Fatal(err)
}

// Check that we have all the wanted methods
if len(haveAligns) != len(wantAligns) {
t.Fatalf("have %d methods with aligned, want %d", len(haveAligns), len(wantAligns))
}

for i := range haveAligns {
method := haveAligns[i].Method
haveAlign := haveAligns[i].Align

wantAlign, ok := wantAligns[method]
if !ok {
t.Errorf("method %s: have aligned %d, want missing entry", method, haveAlign)
} else if haveAlign != wantAlign {
t.Errorf("method %s: have aligned %d, want %d", method, haveAlign, wantAlign)
}
}
}

func parseAlign(filename string) ([]methodAlign, error) {
file, err := os.Open(filename)
if err != nil {
return nil, fmt.Errorf("failed to open file: %w", err)
}
defer file.Close()

var results []methodAlign
scanner := bufio.NewScanner(file)

// Regex to match function declarations like "struct MethodName_return MethodName("
funcRegex := regexp.MustCompile(`^struct\s+(\w+)_return\s+(\w+)\(`)
// Regex to match simple function declarations like "GoSlice MethodName("
simpleFuncRegex := regexp.MustCompile(`^Go\w+\s+(\w+)\(`)
// Regex to match void-returning exported functions like "void ReturnEmpty("
voidFuncRegex := regexp.MustCompile(`^void\s+(\w+)\(`)
// Regex to match align attributes like "__attribute__((aligned(8)))"
alignRegex := regexp.MustCompile(`__attribute__\(\(aligned\((\d+)\)\)\)`)

var currentMethod string

for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())

// Check if this line declares a function with struct return type
if matches := funcRegex.FindStringSubmatch(line); matches != nil {
currentMethod = matches[2] // Extract the method name
} else if matches := simpleFuncRegex.FindStringSubmatch(line); matches != nil {
// Check if this line declares a function with simple return type (like GoSlice)
currentMethod = matches[1] // Extract the method name
} else if matches := voidFuncRegex.FindStringSubmatch(line); matches != nil {
// Check if this line declares a void-returning function
currentMethod = matches[1] // Extract the method name
}

// Check if this line contains align information
if alignMatches := alignRegex.FindStringSubmatch(line); alignMatches != nil && currentMethod != "" {
alignStr := alignMatches[1]
align, err := strconv.Atoi(alignStr)
if err != nil {
// Skip this entry if we can't parse the align as integer
currentMethod = ""
continue
}
results = append(results, methodAlign{
Method: currentMethod,
Align: align,
})
currentMethod = "" // Reset for next method
}
}

if err := scanner.Err(); err != nil {
return nil, fmt.Errorf("error reading file: %w", err)
}

return results, nil
}
63 changes: 63 additions & 0 deletions src/cmd/cgo/internal/testout/testdata/aligned.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import "C"

//export ReturnEmpty
func ReturnEmpty() {
return
}

//export ReturnOnlyUint8
func ReturnOnlyUint8() (uint8, uint8, uint8) {
return 1, 2, 3
}

//export ReturnOnlyUint16
func ReturnOnlyUint16() (uint16, uint16, uint16) {
return 1, 2, 3
}

//export ReturnOnlyUint32
func ReturnOnlyUint32() (uint32, uint32, uint32) {
return 1, 2, 3
}

//export ReturnOnlyUint64
func ReturnOnlyUint64() (uint64, uint64, uint64) {
return 1, 2, 3
}

//export ReturnOnlyInt
func ReturnOnlyInt() (int, int, int) {
return 1, 2, 3
}

//export ReturnOnlyPtr
func ReturnOnlyPtr() (*int, *int, *int) {
a, b, c := 1, 2, 3
return &a, &b, &c
}

//export ReturnString
func ReturnString() string {
return "hello"
}

//export ReturnByteSlice
func ReturnByteSlice() []byte {
return []byte{1, 2, 3}
}

//export InputAndReturnUint8
func InputAndReturnUint8(a, b, c uint8) (uint8, uint8, uint8) {
return a, b, c
}

//export MixedTypes
func MixedTypes(a uint8, b uint16, c uint32, d uint64, e int, f *int) (uint8, uint16, uint32, uint64, int, *int) {
return a, b, c, d, e, f
}
13 changes: 12 additions & 1 deletion src/cmd/cgo/out.go
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,8 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
fmt.Fprintf(gotype, "struct {\n")
off := int64(0)
npad := 0
// the align is at least 1 (for char)
maxAlign := int64(1)
argField := func(typ ast.Expr, namePat string, args ...interface{}) {
name := fmt.Sprintf(namePat, args...)
t := p.cgoType(typ)
Expand All @@ -963,6 +965,11 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
noSourceConf.Fprint(gotype, fset, typ)
fmt.Fprintf(gotype, "\n")
off += t.Size
// keep track of the maximum alignment among all fields
// so that we can align the struct correctly
if t.Align > maxAlign {
maxAlign = t.Align
}
}
if fn.Recv != nil {
argField(fn.Recv.List[0].Type, "recv")
Expand Down Expand Up @@ -1051,7 +1058,11 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
// string.h for memset, and is also robust to C++
// types with constructors. Both GCC and LLVM optimize
// this into just zeroing _cgo_a.
fmt.Fprintf(fgcc, "\ttypedef %s %v _cgo_argtype;\n", ctype.String(), p.packedAttribute())
//
// The struct should be aligned to the maximum alignment
// of any of its fields. This to avoid alignment
// issues.
fmt.Fprintf(fgcc, "\ttypedef %s %v __attribute__((aligned(%d))) _cgo_argtype;\n", ctype.String(), p.packedAttribute(), maxAlign)
fmt.Fprintf(fgcc, "\tstatic _cgo_argtype _cgo_zero;\n")
fmt.Fprintf(fgcc, "\t_cgo_argtype _cgo_a = _cgo_zero;\n")
if gccResult != "void" && (len(fntype.Results.List) > 1 || len(fntype.Results.List[0].Names) > 1) {
Expand Down
15 changes: 15 additions & 0 deletions src/cmd/compile/internal/dwarfgen/dwarf.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,29 @@ func Info(ctxt *obj.Link, fnsym *obj.LSym, infosym *obj.LSym, curfn obj.Func) (s
// already referenced by a dwarf var, attach an R_USETYPE relocation to
// the function symbol to insure that the type included in DWARF
// processing during linking.
// Do the same with R_USEIFACE relocations from the function symbol for the
// same reason.
// All these R_USETYPE relocations are only looked at if the function
// survives deadcode elimination in the linker.
typesyms := []*obj.LSym{}
for t := range fnsym.Func().Autot {
typesyms = append(typesyms, t)
}
for i := range fnsym.R {
if fnsym.R[i].Type == objabi.R_USEIFACE && !strings.HasPrefix(fnsym.R[i].Sym.Name, "go:itab.") {
// Types referenced through itab will be referenced from somewhere else
typesyms = append(typesyms, fnsym.R[i].Sym)
}
}
slices.SortFunc(typesyms, func(a, b *obj.LSym) int {
return strings.Compare(a.Name, b.Name)
})
var lastsym *obj.LSym
for _, sym := range typesyms {
if sym == lastsym {
continue
}
lastsym = sym
infosym.AddRel(ctxt, obj.Reloc{Type: objabi.R_USETYPE, Sym: sym})
}
fnsym.Func().Autot = nil
Expand Down
Loading