1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-22 17:18:37 +00:00

fix(reader): fix a crash introduced by d59990f1

And add a fuzzer and a testcase as well to validate that nothing breaks.
This commit is contained in:
jvoisin 2025-06-10 22:35:55 +02:00
parent 70b513b8db
commit 8bde80163d
2 changed files with 28 additions and 3 deletions

View file

@ -61,9 +61,11 @@ func filterValidXMLChars(s []byte) []byte {
if r >= utf8.RuneSelf {
r, wid = utf8.DecodeRune(s[i:])
}
if r = filterValidXMLChar(r); r >= 0 {
utf8.EncodeRune(s[j:], r)
j += wid
if r != utf8.RuneError {
if r = filterValidXMLChar(r); r >= 0 {
utf8.EncodeRune(s[j:], r)
j += wid
}
}
i += wid
}