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

Infinite loop with some documents #4

Open
hellodword opened this issue Nov 13, 2022 · 3 comments
Open

Infinite loop with some documents #4

hellodword opened this issue Nov 13, 2022 · 3 comments

Comments

@hellodword
Copy link

hellodword commented Nov 13, 2022

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="html">
      Less: &lt;em> &amp;lt; &lt;/em>
  </title>
</feed>

or

<a><b>></b></a>
	var a struct {
		XMLName xml.Name
	}

	err := xml.Unmarshal([]byte(s), &a)
	fmt.Println(err)

It works with encoding/xml.

@hellodword
Copy link
Author

func (d *Decoder) Token() (Token, error) may return nil, nil with some documents.

@hellodword
Copy link
Author

xml/xml.go

Lines 1035 to 1038 in a78369b

// This occurs only for an unquoted attr name.
if b == '>' && !cdata && quote < 0 { // Possible end of tag reached
d.ungetc('>') // Leaving end of tag available
break // returning text

hellodword added a commit to hellodword/xml that referenced this issue Nov 13, 2022
hellodword added a commit to hellodword/grss that referenced this issue Nov 13, 2022
@hellodword
Copy link
Author

@ydnar I noticed that you're opening a PR in golang/go, so I think I should keep this issue open :)

Because I confirmed the issue is still there, with the latest github.com/nbio/xml and Go 1.22.2

@hellodword hellodword reopened this May 9, 2024
hellodword added a commit to hellodword/grss that referenced this issue May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant