[Python-checkins] python/dist/src/Parser tokenizer.c,2.70,2.71

mhammond@users.sourceforge.net mhammond@users.sourceforge.net
Tue, 14 Jan 2003 15:15:24 -0800


Update of /cvsroot/python/python/dist/src/Parser
In directory sc8-pr-cvs1:/tmp/cvs-serv29119

Modified Files:
	tokenizer.c 
Log Message:
Fix [ 665014 ] files with long lines and an encoding crash.

Ensure that the 'size' arg is correctly passed to the encoding reader to
prevent buffer overflows.


Index: tokenizer.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v
retrieving revision 2.70
retrieving revision 2.71
diff -C2 -d -r2.70 -r2.71
*** tokenizer.c	11 Dec 2002 14:04:58 -0000	2.70
--- tokenizer.c	14 Jan 2003 23:15:22 -0000	2.71
***************
*** 347,351 ****
  	PyObject* buf = tok->decoding_buffer;
  	if (buf == NULL) {
! 		PyObject *args = PyTuple_New(0);
  		if (args == NULL)
  			return error_ret(tok);
--- 347,352 ----
  	PyObject* buf = tok->decoding_buffer;
  	if (buf == NULL) {
! 		/* Ask for one less byte so we can terminate it */
! 		PyObject *args = Py_BuildValue("(i)", size-1);
  		if (args == NULL)
  			return error_ret(tok);