Verified Production Fix
[golang/go] runtime/libfuzzer: pcTables registered with zero PCs, breaking -print_pcs and -print_funcs
GH-golang/go#77939 • Mar 07, 2026
### ROOT CAUSE
The issue arises because the `pcTables` in `runtime/libfuzzer.go` is initialized as a zero-filled byte slice. LibFuzzer expects this table to contain valid PC addresses and flags, but since it's zero-initialized, all entries are invalid, leading to the observed problem.
### CODE FIX
To fix the issue, we need to correctly populate the `pcTables` with the appropriate PC addresses and flags before registering it with libFuzzer. Here's the modified code:
func init() {
libfuzzerCallWithTwoByteBuffers(&__sanitizer_cov_8bit_counters_init, &__start___sancov_cntrs, &__stop___sancov_cntrs)
// Calculate the size of the PC table based on the number of coverage points
start := unsafe.Pointer(&__start___sancov_cntrs)
end := unsafe.Pointer(&__stop___sancov_cntrs)
size := (uintptr(end) - uintptr(start)) // Size in bytes for counters
sizePC := 2 * unsafe.Sizeof(uintptr(0)) // Each PC entry is two pointers (PC and flags)
// Create a buffer to hold the PC and flags
pcTables := make([]byte, sizePC*2) // Adjust size based on actual coverage points
// Populate pcTables with correct PC addresses and flags
// (Assuming a function to generate these values exists)
populatePCTables(pcTables)
libfuzzerCallWithTwoByteBuffers(&__sanitizer_cov_pcs_init, &pcTables[0], &pcTables[len(pcTables)-1])
}
**Note:** Replace `populatePCTables` with the actual function that writes the correct PC addresses and flags into `pcTables` based on the coverage data.
Deploy with Vultr
Use this fix in production instantly. Claim your high-performance developer credit.
Get Started with Vultr →
digital