[New-bugs-announce] [issue40880] Invalid read in pegen.c

Stefan Krah report at bugs.python.org
Fri Jun 5 18:00:14 EDT 2020


New submission from Stefan Krah <stefan at bytereef.org>:

>From test_decimal:

test_xor (test.test_decimal.PyIBMTestCases) ... ==17597== Invalid read of size 1
==17597==    at 0x64A7E2: newline_in_string (pegen.c:940)
==17597==    by 0x64A84E: bad_single_statement (pegen.c:958)
==17597==    by 0x64AD59: _PyPegen_run_parser (pegen.c:1101)
==17597==    by 0x64B044: _PyPegen_run_parser_from_string (pegen.c:1194)
==17597==    by 0x5C6D56: PyPegen_ASTFromStringObject (peg_api.c:27)
==17597==    by 0x52A2A9: Py_CompileStringObject (pythonrun.c:1259)
==17597==    by 0x63CBF6: builtin_compile_impl (bltinmodule.c:819)
==17597==    by 0x63AF08: builtin_compile (bltinmodule.c.h:249)
==17597==    by 0x5F9446: cfunction_vectorcall_FASTCALL_KEYWORDS (methodobject.c:440)
==17597==    by 0x4D2642: _PyObject_VectorcallTstate (abstract.h:114)
==17597==    by 0x4D26A1: PyObject_Vectorcall (abstract.h:123)
==17597==    by 0x4E3F26: call_function (ceval.c:5111)
==17597==  Address 0xadc82bf is 1 bytes before a block of size 22 alloc'd
==17597==    at 0x4C3016F: realloc (vg_replace_malloc.c:826)
==17597==    by 0x46A983: _PyMem_RawRealloc (obmalloc.c:121)
==17597==    by 0x46B49E: PyMem_Realloc (obmalloc.c:623)
==17597==    by 0x5C9565: translate_newlines (tokenizer.c:654)
==17597==    by 0x5C98FE: PyTokenizer_FromUTF8 (tokenizer.c:751)
==17597==    by 0x64AF7F: _PyPegen_run_parser_from_string (pegen.c:1169)
==17597==    by 0x5C6D56: PyPegen_ASTFromStringObject (peg_api.c:27)
==17597==    by 0x52A2A9: Py_CompileStringObject (pythonrun.c:1259)
==17597==    by 0x63CBF6: builtin_compile_impl (bltinmodule.c:819)
==17597==    by 0x63AF08: builtin_compile (bltinmodule.c.h:249)
==17597==    by 0x5F9446: cfunction_vectorcall_FASTCALL_KEYWORDS (methodobject.c:440)
==17597==    by 0x4D2642: _PyObject_VectorcallTstate (abstract.h:114)
==17597== 



*--cur dereferences one below p->tok->buf in the last iteration.

----------
components: Interpreter Core
messages: 370791
nosy: lys.nikolaou, skrah
priority: normal
severity: normal
stage: needs patch
status: open
title: Invalid read in pegen.c
type: behavior
versions: Python 3.10, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40880>
_______________________________________


More information about the New-bugs-announce mailing list