aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/c_src/wxe_return.cpp
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2015-05-19 10:01:42 +0200
committerDan Gudmundsson <[email protected]>2015-06-01 13:07:32 +0200
commit5b2ad02d50a23b5e82f9ebbc644622e42199ea95 (patch)
treefead9dbe4e5365808940e3e301c76745e4f976da /lib/wx/c_src/wxe_return.cpp
parent8260f916c2ab9b9dff9752b47e47d07ac3d95c92 (diff)
downloadotp-5b2ad02d50a23b5e82f9ebbc644622e42199ea95.tar.gz
otp-5b2ad02d50a23b5e82f9ebbc644622e42199ea95.tar.bz2
otp-5b2ad02d50a23b5e82f9ebbc644622e42199ea95.zip
wx: Fix bad float in return values
To many floats in return value could cause a reallocation and pointers to reallocated data. Fix it by ensuring that the temp float array is large enough before add values to it.
Diffstat (limited to 'lib/wx/c_src/wxe_return.cpp')
-rw-r--r--lib/wx/c_src/wxe_return.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/wx/c_src/wxe_return.cpp b/lib/wx/c_src/wxe_return.cpp
index aebf6bae1b..accd818a14 100644
--- a/lib/wx/c_src/wxe_return.cpp
+++ b/lib/wx/c_src/wxe_return.cpp
@@ -84,7 +84,13 @@ INLINE
unsigned int wxeReturn::size() {
return rt.GetCount();
}
-
+
+
+INLINE
+void wxeReturn::ensureFloatCount(size_t n) {
+ temp_float.Alloc(n);
+}
+
INLINE
void wxeReturn::add(ErlDrvTermData type, ErlDrvTermData data) {
rt.Add(type);
@@ -222,6 +228,7 @@ INLINE
void wxeReturn::add(wxArrayDouble val) {
unsigned int len = val.GetCount();
+ temp_float.Alloc(len);
for (unsigned int i = 0; i< len; i++) {
addFloat(val[i]);
}