File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ What's New in Python 3.0 release candidate 1
1212Core and Builtins
1313-----------------
1414
15+ - Issue 3774: Added a few more checks in PyTokenizer_FindEncoding to handle
16+ error conditions.
17+
1518- Issue 3594: Fix Parser/tokenizer.c:fp_setreadl() to open the file being
1619 tokenized by either a file path or file pointer for the benefit of
1720 PyTokenizer_FindEncoding().
Original file line number Diff line number Diff line change @@ -1610,7 +1610,10 @@ PyTokenizer_FindEncoding(int fd)
16101610 fclose (fp );
16111611 if (tok -> encoding ) {
16121612 encoding = (char * )PyMem_MALLOC (strlen (tok -> encoding ) + 1 );
1613- strcpy (encoding , tok -> encoding );
1613+ if (encoding )
1614+ strcpy (encoding , tok -> encoding );
1615+ else
1616+ PyErr_NoMemory ();
16141617 }
16151618 PyTokenizer_Free (tok );
16161619 return encoding ;
Original file line number Diff line number Diff line change @@ -2830,6 +2830,8 @@ call_find_module(char *name, PyObject *path)
28302830 memory. */
28312831 found_encoding = PyTokenizer_FindEncoding (fd );
28322832 lseek (fd , 0 , 0 ); /* Reset position */
2833+ if (found_encoding == NULL && PyErr_Occurred ())
2834+ return NULL ;
28332835 encoding = (found_encoding != NULL ) ? found_encoding :
28342836 (char * )PyUnicode_GetDefaultEncoding ();
28352837 }
You can’t perform that action at this time.
0 commit comments