From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Library:Go runtime" |
|---|
| claim | "The Go build-info blob is a 32-byte header followed (Go 1.18+, flags bit 1 set) by two uvarint-length-prefixed strings: the toolchain version and the module info. Before 1.18 (flags bit 1 clear) the two pointer fields point to Go string headers instead, with flags bit 0 giving their byte order. The module info string is framed by 16-byte sentinels 30 77 AF 0C 92 74 08 02 41 E1 C1 07 E6 D6 18 E6 and F9 32 43 31 86 18 20 72 00 82 42 10 41 16 D8 F2." |
|---|
| scope | | level | "library" |
|---|
| applies_to | "Library:Go runtime" |
|---|
| observed_in | | "Build:Mailpit/1.22.3 (Windows x64, GitHub release mailpit-windows-amd64.zip)" |
|
|---|
|
|---|
| data | | name | "buildInfoHeader" |
|---|
| size | "0x20" |
|---|
| alignment | 16 |
|---|
| fields | | offset | "0x0" |
|---|
| size | 14 |
|---|
| type | "char[14]" |
|---|
| name | "magic" |
|---|
| notes | "\xff Go buildinf:" |
|---|
|
| offset | "0xE" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "ptrSize" |
|---|
| notes | "4 or 8; only used by the pre-1.18 pointer form" |
|---|
|
| offset | "0xF" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "flags" |
|---|
| bits | | bit | "0" |
|---|
| name | "big_endian" |
|---|
| notes | "byte order of versPtr/modPtr; only read in the pre-1.18 pointer form" |
|---|
|
| bit | "1" |
|---|
| name | "inline_strings" |
|---|
| notes | "Go 1.18+: version and modinfo follow the 32-byte header as uvarint length + bytes" |
|---|
|
|
|---|
|
| offset | "0x10" |
|---|
| size | 8 |
|---|
| type | "uint64_t" |
|---|
| name | "versPtr" |
|---|
| notes | "pre-1.18 only: address of a Go string header; ptrSize bytes (4 on 32-bit, then the header is still padded to 32 bytes)" |
|---|
|
| offset | "0x18" |
|---|
| size | 8 |
|---|
| type | "uint64_t" |
|---|
| name | "modPtr" |
|---|
| notes | "pre-1.18 only; located at 0x10 + ptrSize, so at 0x14 (4 bytes) when ptrSize is 4" |
|---|
|
|
|---|
| test_vectors | | input | "Mailpit v1.22.3 linux/amd64 (SHA-256 a220d8073ec8944445e726ee28f2955c307efd128848b22cd9c25932ffa97980), file offset 0x1293000, 64 bytes" |
|---|
| expected | "FF 20 47 6F 20 62 75 69 6C 64 69 6E 66 3A 08 02 + 16 x 00 + 08 67 6F 31 2E 32 34 2E 30 ("go1.24.0") + E4 25 (modinfo length 4836) + 30 77 AF 0C 92 74 08 02 41 E1 C1 07 E6 D6 18 E6 70 61 74 68 09 ("path\t")" |
|---|
|
|
|---|
| samples | | url | "https://github.com/axllent/mailpit/releases/download/v1.22.3/mailpit-linux-amd64.tar.gz" |
|---|
| sha256 | "85c7594c3dbdc619f64f9f831534332bc1861d755a9c85b88046be670e2eb0e2" |
|---|
| note | "the mailpit ELF inside has SHA-256 a220d8073ec8944445e726ee28f2955c307efd128848b22cd9c25932ffa97980" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "readRawBuildInfo: ptrSizeOffset 14, flagsOffset 15, versPtrOffset 16, flagsEndianBig 0x1, flagsVersionInl 0x2; strips 16-byte framing when mod[len-17]=='\n'" |
|---|
| repo | "https://github.com/golang/go" |
|---|
| commit | "dfc6f7db9bd75868ffb5cbc9501a2f4899122d2f" |
|---|
| path | "src/debug/buildinfo/buildinfo.go" |
|---|
| lines | "191-268" |
|---|
|
| type | "source" |
|---|
| detail | "infoStart = 3077af0c9274080241e1c107e6d618e6, infoEnd = f932433186182072008242104116d8f2" |
|---|
| repo | "https://github.com/golang/go" |
|---|
| commit | "dfc6f7db9bd75868ffb5cbc9501a2f4899122d2f" |
|---|
| path | "src/cmd/go/internal/modload/build.go" |
|---|
| lines | "29-30" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "gobin.py decoded go1.24.0 and 61/64 modinfo lines from the two Mailpit v1.22.3 builds (inline format) and go1.17 + module example.com/go117 from the Go 1.17 test binary (pointer format, flags 0x00)." |
|---|
|
| type | "source" |
|---|
| detail | "readRawBuildInfo else-branch (flagsVersionPtr): readPtr(header[versPtrOffset:]) and readPtr(header[versPtrOffset+ptrSize:]); ptrSize 4 or 8 only, else errNotGoExe; endian flag read only there" |
|---|
| repo | "https://github.com/golang/go" |
|---|
| commit | "dfc6f7db9bd75868ffb5cbc9501a2f4899122d2f" |
|---|
| path | "src/debug/buildinfo/buildinfo.go" |
|---|
| lines | "214-262" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Build info header" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T09:13:42.312Z" |
|---|
| verifications | |
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T12:13:01.115Z" |
|---|
| summary | "modPtr offset depends on ptrSize: readRawBuildInfo reads modPtr at versPtrOffset+ptrSize (0x14 on 32-bit, 0x18 on 64-bit); the flags endian bit applies only to the pre-1.18 pointer form." |
|---|
| changed | |
|---|
|
|
|---|