Fix unintended uninitialised memory access in OUTPUT typemaps
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13074 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
d9393bc22a
commit
4dfe131207
2 changed files with 18 additions and 0 deletions
|
|
@ -195,6 +195,7 @@ There are no char *OUTPUT typemaps, however you can apply the signed char * type
|
|||
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
|
||||
return $null;
|
||||
}
|
||||
temp = ($*1_ltype)0;
|
||||
$1 = &temp;
|
||||
}
|
||||
|
||||
|
|
@ -226,6 +227,20 @@ OUTPUT_TYPEMAP(double, jdouble, double, Double, "[Ljava/lang/Double;", jdoubleAr
|
|||
|
||||
#undef OUTPUT_TYPEMAP
|
||||
|
||||
%typemap(in) bool *OUTPUT($*1_ltype temp), bool &OUTPUT($*1_ltype temp)
|
||||
{
|
||||
if (!$input) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
|
||||
return $null;
|
||||
}
|
||||
if (JCALL1(GetArrayLength, jenv, $input) == 0) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
|
||||
return $null;
|
||||
}
|
||||
temp = false;
|
||||
$1 = &temp;
|
||||
}
|
||||
|
||||
/* Convert to BigInteger - byte array holds number in 2's complement big endian format */
|
||||
/* Use first element in BigInteger array for output */
|
||||
/* Overrides the typemap in the OUTPUT_TYPEMAP macro */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue