Guile - Add error checking to SWIGTYPE and SWIGTYPE & in typemaps
To prevent seg faults when passing #nil to these parameter types.
This commit is contained in:
parent
dad7c93ca0
commit
c5610fd4b3
2 changed files with 12 additions and 2 deletions
|
|
@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.1.0 (in progress)
|
Version 4.1.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2022-09-17: wsfulton
|
||||||
|
[Guile] Add error checking to SWIGTYPE and SWIGTYPE & in typemaps to prevent
|
||||||
|
seg faults when passing #nil to these parameter types.
|
||||||
|
|
||||||
2022-09-16: wsfulton
|
2022-09-16: wsfulton
|
||||||
#999 Provide SWIGTYPE MOVE typemaps in swigmove.i for implementing full
|
#999 Provide SWIGTYPE MOVE typemaps in swigmove.i for implementing full
|
||||||
move semantics when passing parameters by value.
|
move semantics when passing parameters by value.
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,14 @@
|
||||||
|
|
||||||
/* Pointers */
|
/* Pointers */
|
||||||
|
|
||||||
%typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
%typemap(in) SWIGTYPE *, SWIGTYPE [] {
|
||||||
$1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0);
|
$1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0);
|
||||||
}
|
}
|
||||||
|
%typemap(in) SWIGTYPE & ($1_ltype argp) {
|
||||||
|
argp = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0);
|
||||||
|
if (!argp) { %argument_nullref("$1_type", $symname, $argnum); }
|
||||||
|
$1 = argp;
|
||||||
|
}
|
||||||
%typemap(in, noblock=1, fragment="<memory>") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) {
|
%typemap(in, noblock=1, fragment="<memory>") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) {
|
||||||
res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE);
|
res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE);
|
||||||
if (!SWIG_IsOK(res)) {
|
if (!SWIG_IsOK(res)) {
|
||||||
|
|
@ -136,8 +141,9 @@
|
||||||
|
|
||||||
/* Pass-by-value */
|
/* Pass-by-value */
|
||||||
|
|
||||||
%typemap(in) SWIGTYPE($&1_ltype argp) {
|
%typemap(in) SWIGTYPE ($&1_ltype argp) {
|
||||||
argp = ($&1_ltype)SWIG_MustGetPtr($input, $&1_descriptor, $argnum, 0);
|
argp = ($&1_ltype)SWIG_MustGetPtr($input, $&1_descriptor, $argnum, 0);
|
||||||
|
if (!argp) { %argument_nullref("$1_type", $symname, $argnum); }
|
||||||
$1 = *argp;
|
$1 = *argp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue