Device
Kindle
KOReader version
latest
Model and firmware version
Kindle Paperwhite
Issue description
Summary
NewsDownloader crashes the whole luajit process when article HTML contains <math> in normal HTML body context.
It segfaults the entire koreader. I noticed this while newsdownloader-parsing this article: https://lucumr.pocoo.org/2025/12/23/advent-of-slop/
DEBUG EpubDownloadBackend:createEpub( koreader/koreader-emulator-arm64-apple-darwin25.3.0-debug/koreader/news/_RSS (Feed Aggregator)/25-12-23_08-00_Advent of Slop_ A Guest Post by Claude.epub )
DEBUG page_htmltitle is Advent of Slop: A Guest Post by Claude
bash: line 1: 27941 Segmentation fault: 11 EMULATE_READER_W=1072 EMULATE_READER_H=1448 EMULATE_READER_DPI=300 ./luajit reader.lua "$@"
make: *** [make/emulator.mk:20: run] Error 139
I traced it down to a MathML parsing bug, I did a minimal reproduction below.
This happens in the HTML balancing step before EPUB generation:
koreader/plugins/newsdownloader.koplugin/epubdownloadbackend.lua:411
cre.getBalancedHTML(html, 0x0)
Steps to reproduce
File:
- Add the test file to
koreader/spec/unit/newsdownloader_mathml_crash_spec.lua
Run:
./kodev test front koreader-testrunner:newsdownloader_mathml_crash
Summary of Failures:
1/1 front - koreader-testrunner:newsdownloader_mathml_crash FAIL 0.08s killed by signal 11 SIGSEGV
Ok: 0
Fail: 1
describe("NewsDownloader MathML crash reproducer", function()
setup(function()
require("commonrequire")
end)
it("crashes in getBalancedHTML with math tag in html body", function()
-- Intentional crash repro for CRengine MathML parse bug.
local cre = require("libs/libkoreader-cre")
cre.getBalancedHTML("<!doctype html><html><body><math></math></body></html>", 0x0)
end)
end)
Additional information
No response
Device
Kindle
KOReader version
latest
Model and firmware version
Kindle Paperwhite
Issue description
Summary
NewsDownloadercrashes the wholeluajitprocess when article HTML contains<math>in normal HTML body context.It segfaults the entire koreader. I noticed this while newsdownloader-parsing this article: https://lucumr.pocoo.org/2025/12/23/advent-of-slop/
I traced it down to a MathML parsing bug, I did a minimal reproduction below.
This happens in the HTML balancing step before EPUB generation:
koreader/plugins/newsdownloader.koplugin/epubdownloadbackend.lua:411cre.getBalancedHTML(html, 0x0)Steps to reproduce
File:
koreader/spec/unit/newsdownloader_mathml_crash_spec.luaRun:
./kodev test front koreader-testrunner:newsdownloader_mathml_crash Summary of Failures: 1/1 front - koreader-testrunner:newsdownloader_mathml_crash FAIL 0.08s killed by signal 11 SIGSEGV Ok: 0 Fail: 1Additional information
No response