Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/xml: SEGFAULT: xml.Escape(*bytes.Buffer,... #3991

gopherbot opened this issue Aug 22, 2012 · 1 comment

encoding/xml: SEGFAULT: xml.Escape(*bytes.Buffer,... #3991

gopherbot opened this issue Aug 22, 2012 · 1 comment


Copy link

@gopherbot gopherbot commented Aug 22, 2012

by mux2005:

What steps will reproduce the problem?
If possible, include a link to a program on


package main

import (
func main() {  
  var buffy *bytes.Buffer
  xml.Escape(buffy, []byte("foo"))

2. Save as test.go

3. go run test.go

What is the expected output?

An intelligible error message informing me that my variable is uninitialized

What do you see instead?

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x58 pc=0x415fa8]

goroutine 1 [running]:
bytes.(*Buffer).Write(0x0, 0xf84005b000, 0x300000003, 0x200000000, 0x0, ...)
    go/src/pkg/bytes/buffer.go:107 +0x30
encoding/xml.Escape(0xf840024570, 0x0, 0xf84005b000, 0x300000003, 0x0, ...)
    go/src/pkg/encoding/xml/xml.go:1673 +0x1a9
    /tmpfs/gosandbox-1ed22190_28b8d3ce_26e32609_9c0c9a0b_60e64093/prog.go:10 +0xa1
Which compiler are you using (5g, 6g, 8g, gccgo)?

Which operating system are you using?

Which version are you using?  (run 'go version')

Please provide any additional information below.

This comment has been minimized.

Copy link

@robpike robpike commented Aug 22, 2012

Comment 1:

Your uninitialized variable is a nil pointer, as the first line of the trace tells you.

Status changed to WorkingAsIntended.

@mikioh mikioh changed the title SEGFAULT: xml.Escape(*bytes.Buffer,... encoding/xml: SEGFAULT: xml.Escape(*bytes.Buffer,... Jan 9, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.