From 2c206bc16bfc9428e725d49ccc9f07975bffefc5 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Thu, 1 Nov 2018 01:20:53 -0400 Subject: [PATCH] Fix crash due to PyList_GET_SIZE being applied to a dict (fixes #208) --- CHANGELOG | 1 + docs/changelog.rst | 2 ++ mwparserfromhell/parser/ctokenizer/tokenizer.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 7a4cb25..7260006 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ v0.6 (unreleased): - Fixed signals getting stuck inside the C tokenizer until parsing finishes, in pathological cases. (#206) - Fixed not being considered a single-only tag. (#200) +- Fixed a C tokenizer crash on Python 3.7 when compiled with assertions. (#208) v0.5.1 (released March 3, 2018): diff --git a/docs/changelog.rst b/docs/changelog.rst index 4941f32..72971a3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -15,6 +15,8 @@ Unreleased (`#206 `) - Fixed `` not being considered a single-only tag. (`#200 `) +- Fixed a C tokenizer crash on Python 3.7 when compiled with assertions. + (`#208 `) v0.5.1 ------ diff --git a/mwparserfromhell/parser/ctokenizer/tokenizer.c b/mwparserfromhell/parser/ctokenizer/tokenizer.c index 9017909..24d0b4a 100644 --- a/mwparserfromhell/parser/ctokenizer/tokenizer.c +++ b/mwparserfromhell/parser/ctokenizer/tokenizer.c @@ -207,7 +207,7 @@ static int load_entities(void) if (!deflist) return -1; Py_DECREF(defmap); - numdefs = (unsigned) PyList_GET_SIZE(defmap); + numdefs = (unsigned) PyList_GET_SIZE(deflist); entitydefs = calloc(numdefs + 1, sizeof(char*)); if (!entitydefs) return -1;