Staging
v0.5.1
https://github.com/python/cpython
Revision b5afbd027bffbaa998c0ea149fdeea75a6a41c2e authored by Guido van Rossum on 30 November 2003, 22:07:34 UTC, committed by Guido van Rossum on 30 November 2003, 22:07:34 UTC
Remove all uses of alloca() from this module.  The alloca() return value
isn't checked, and it *is* possible that a very large alloca() call is
made, e.g. when a large registry value is being read.  I don't know if
alloca() in that case returns NULL or returns a pointer pointing outside
the stack, and I don't want to know -- I've simply replaced all calls to
alloca() with either PyMem_Malloc() or PyString_FromStringAndSize(NULL,)
as appropriate, followed by a size check.  This addresses SF buf 851056.
1 parent dfea1bb
Raw File
Tip revision: b5afbd027bffbaa998c0ea149fdeea75a6a41c2e authored by Guido van Rossum on 30 November 2003, 22:07:34 UTC
Backport:
Tip revision: b5afbd0
marshal.h

/* Interface for marshal.c */

#ifndef Py_MARSHAL_H
#define Py_MARSHAL_H
#ifdef __cplusplus
extern "C" {
#endif

PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *);
PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *);
PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *);

PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *);
PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *);
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *);
PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *);
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, int);

#ifdef __cplusplus
}
#endif
#endif /* !Py_MARSHAL_H */
back to top