SWIG_AsWCharPtrAndSize improper operation if cptr NULL
SF bug #1327 This doesn't have any noticeable effect with the usage of SWIG_AsWCharPtrAndSize as shipped by SWIG, but could be a problem if a user is using this function with cptr equal to zero and psize is non-zero - the length would be incorrectly set due to the call to PyUnicode_GetSize failing.
This commit is contained in:
parent
d3252bbf7f
commit
ace8fcd972
3 changed files with 15 additions and 3 deletions
|
|
@ -38,6 +38,14 @@ wchar_t* test_cvalue(wchar_t* x) {
|
|||
}
|
||||
|
||||
|
||||
wchar_t* test_wchar_overload() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
wchar_t* test_wchar_overload(wchar_t *x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
std::wstring test_value(std::wstring x) {
|
||||
return x;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,12 @@ if li_std_wstring.test_ccvalue(x) != x:
|
|||
if li_std_wstring.test_cvalue(x) != x:
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_wstring.test_wchar_overload(x) != x:
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_wstring.test_wchar_overload("not unicode") != "not unicode":
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_wstring.test_value(x) != x:
|
||||
print x, li_std_wstring.test_value(x)
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue