go-xmlpath / xmlpath

Strict subset of the XPath specification for the Go language.
http://gopkg.in/xmlpath.v2
Other
115 stars 37 forks source link

Infinite recursion with `%#v` formatter #3

Open Wessie opened 10 years ago

Wessie commented 10 years ago

Giving any of the fmt.*f functions a xmlpath.Node will result in an infinite recursion and an eventual stack overflow. This happens due to Node.nodes containing non-pointers and the recursive referencing with the nodes in it.

non-xmlpath reproduce xmlpath reproduce

While the fmt package is the one at fault for not handling recursion. xmlpath might want to implement a GoString to avoid the stack overflow for users.

Reported it as a Go issue too as issue 8241. This mostly to get a fmt documentation update.