[New-bugs-announce] [issue3623] _json: fix raise_errmsg(), py_encode_basestring_ascii() and linecol()

STINNER Victor report at bugs.python.org
Thu Aug 21 00:58:44 CEST 2008


New submission from STINNER Victor <haypo at users.sourceforge.net>:

_json module of python 3.0 has some bugs.

(a) [_json.c] raise_errmsg() calls json.decoder.errmsg() from Python 
module, but this function may fails. If it fails, error should be be 
set to NULL. Example:

>>> import _json
>>> _json.scanstring(b"xxx", 1, "xxx")
Erreur de segmentation (core dumped)

=> json.decoder.errmsg() calls linecol() which raise an error on 
b"xxx".index("\n").

(b) [_json.c] py_encode_basestring_ascii() calls PyBytes_Check(rval) 
but rval can be NULL if ascii_escape_str() or ascii_escape_unicode() 
fails. Example:

>>> import _json
>>> _json.encode_basestring_ascii(b"xx\xff")
Erreur de segmentation (core dumped)

(c) [Lib/json/decoder.py] linecol() doesn't support bytes, but it's 
called with bytes argument: see point (a). For an example, see point 
(a).

----------
components: Library (Lib)
files: _json.patch
keywords: patch
messages: 71588
nosy: haypo
severity: normal
status: open
title: _json: fix raise_errmsg(), py_encode_basestring_ascii() and linecol()
type: crash
versions: Python 3.0
Added file: http://bugs.python.org/file11181/_json.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3623>
_______________________________________


More information about the New-bugs-announce mailing list