Skip to content

OPDS: fix crash on feeds with single-quoted XML attributes#15068

Merged
Frenzie merged 2 commits into
koreader:masterfrom
msk:fix/opds-single-quote-attrs
Mar 3, 2026
Merged

OPDS: fix crash on feeds with single-quoted XML attributes#15068
Frenzie merged 2 commits into
koreader:masterfrom
msk:fix/opds-single-quote-attrs

Conversation

@msk

@msk msk commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #14571.

The luxl XML lexer only recognizes double-quoted attribute values ("), so single-quoted ones (') cause the parser to enter an error state and silently drop all remaining entries and their links. This PR adds a CCLASS_SQUOTE character class and ST_ATTR_VAL_SQ state to the luxl FSM so single-quoted attributes are parsed correctly without cross-matching. It also adds a nil guard on entry.url in getSyncDownloadList to prevent a crash when an entry has no navigation link.


This change is Reviewable

msk added 2 commits March 3, 2026 13:39
Add a CCLASS_SQUOTE character class and ST_ATTR_VAL_SQ state to the
lexer FSM so single-quoted attributes are parsed correctly without
cross-matching with double-quoted ones. Both quoting styles are valid
XML per the spec.
Add a nil check on entry URL in getSyncDownloadList to prevent a
crash when a feed entry has no navigation link. Add a test for
single-quoted attribute feeds.
@msk msk force-pushed the fix/opds-single-quote-attrs branch from d1665e7 to 174b3f9 Compare March 3, 2026 21:49
@Frenzie Frenzie added the Plugin label Mar 3, 2026
@Frenzie Frenzie merged commit 4cc4996 into koreader:master Mar 3, 2026
4 checks passed
@Frenzie Frenzie added this to the 2026.02 milestone Mar 3, 2026
@msk msk deleted the fix/opds-single-quote-attrs branch March 3, 2026 22:07
@Frenzie

Frenzie commented Mar 3, 2026

Copy link
Copy Markdown
Member

Possibly worth noting there's a competing parser hiding in the codebase. Someday we'll need to do something about that…

https://github.com/koreader/koreader/blob/e4143e23c4eb30c60d9b5ca50613de75c2d33a81/plugins/newsdownloader.koplugin/lib/xml.lua

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash when syncing opds directories

2 participants