summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-07-26 06:07:53 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-07-26 06:07:53 (GMT)
commit76a64ca4388493c8b518a256e3cc0e9b5ed3b3f3 (patch)
treeddcb8295413ae5afe3456fc96587899ccb41cefe
parentcf74c1996e084aa840db0782da833f640a3923e3 (diff)
downloadcpython-76a64ca4388493c8b518a256e3cc0e9b5ed3b3f3.zip
cpython-76a64ca4388493c8b518a256e3cc0e9b5ed3b3f3.tar.gz
cpython-76a64ca4388493c8b518a256e3cc0e9b5ed3b3f3.tar.bz2
Issue #24683: Fixed a crash in _json.make_encoder() called with non-dict 1st argument.
-rw-r--r--Modules/_json.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/_json.c b/Modules/_json.c
index 121126d..5dac038 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -1850,6 +1850,13 @@ encoder_init(PyObject *self, PyObject *args, PyObject *kwds)
if (allow_nan < 0)
return -1;
+ if (markers != Py_None && !PyDict_Check(markers)) {
+ PyErr_Format(PyExc_TypeError,
+ "make_encoder() argument 1 must be dict or None, "
+ "not %.200s", Py_TYPE(markers)->tp_name);
+ return -1;
+ }
+
s->markers = markers;
s->defaultfn = defaultfn;
s->encoder = encoder;