Skip to content

Commit

Permalink
Fix undefined behavior in coin.cast and soqt.cast functions
Browse files Browse the repository at this point in the history
  • Loading branch information
marioalexis84 authored and looooo committed Aug 24, 2022
1 parent 3a344e1 commit fce09ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions interfaces/pivy_common_typemaps.i
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef int Py_ssize_t;
#endif

PyObject *
cast_internal(PyObject * self, PyObject * obj, const char * type_name, int type_len)
cast_internal(PyObject * self, PyObject * obj, const char * type_name, Py_ssize_t type_len)
{
swig_type_info * swig_type = 0;
void * cast_obj = 0;
Expand Down Expand Up @@ -76,7 +76,7 @@ SWIGEXPORT PyObject *
cast(PyObject * self, PyObject * args)
{
char * type_name;
int type_len;
Py_ssize_t type_len;
PyObject * obj = 0;

if (!PyArg_ParseTuple(args, "Os#:cast", &obj, &type_name, &type_len)) {
Expand Down
3 changes: 3 additions & 0 deletions interfaces/soqt.i
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ otherwise it will fall back to regular SWIG structures."

%module(package="pivy.gui", docstring=SOQT_MODULE_DOCSTRING) soqt

%begin %{
#define PY_SSIZE_T_CLEAN
%}

%{
/*
Expand Down

0 comments on commit fce09ce

Please sign in to comment.