Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2013-04-05 20:28:28 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2013-04-08 01:42:13 +0400
commit7c0415dd85fad3a0143cbeadb2c5bf016865e9a4 (patch)
tree2ed22672ee027eb8ace1b17cdb2b3f7fedd49933 /src/thirdparty/VirtualDub
parenta0e49fe24d028852d3a64f3a29fc2fe6ee63185f (diff)
update VirtualDub to v1.10.4-test6
Diffstat (limited to 'src/thirdparty/VirtualDub')
-rw-r--r--src/thirdparty/VirtualDub/h/vd2/system/vdstl.h17
-rw-r--r--src/thirdparty/VirtualDub/system/source/vdstl.cpp9
2 files changed, 18 insertions, 8 deletions
diff --git a/src/thirdparty/VirtualDub/h/vd2/system/vdstl.h b/src/thirdparty/VirtualDub/h/vd2/system/vdstl.h
index a489955fd..d0f70bc71 100644
--- a/src/thirdparty/VirtualDub/h/vd2/system/vdstl.h
+++ b/src/thirdparty/VirtualDub/h/vd2/system/vdstl.h
@@ -81,7 +81,7 @@ T *vdmove_backward(T *src1, T *src2, T *dst) {
///////////////////////////////////////////////////////////////////////////
class vdallocator_base {
protected:
- void VDNORETURN throw_oom();
+ void VDNORETURN throw_oom(size_t n, size_t elsize);
};
template<class T>
@@ -101,10 +101,13 @@ public:
const_pointer address(const_reference x) const { return &x; }
pointer allocate(size_type n, void *p_close = 0) {
+ if (n > ((~(size_type)0) >> 1) / sizeof(T))
+ throw_oom(n, sizeof(T));
+
pointer p = (pointer)malloc(n*sizeof(T));
if (!p)
- throw_oom();
+ throw_oom(n, sizeof(T));
return p;
}
@@ -285,10 +288,11 @@ public:
if (mpBlock) {
A::deallocate(mpBlock, mSize);
mpBlock = NULL;
+ mSize = 0;
}
- mSize = s;
if (s)
- mpBlock = A::allocate(mSize, 0);
+ mpBlock = A::allocate(s, 0);
+ mSize = s;
}
}
@@ -297,12 +301,13 @@ public:
if (mpBlock) {
A::deallocate(mpBlock, mSize);
mpBlock = NULL;
+ mSize = 0;
}
- mSize = s;
if (s) {
- mpBlock = A::allocate(mSize, 0);
+ mpBlock = A::allocate(s, 0);
std::fill(mpBlock, mpBlock+s, value);
}
+ mSize = s;
}
}
diff --git a/src/thirdparty/VirtualDub/system/source/vdstl.cpp b/src/thirdparty/VirtualDub/system/source/vdstl.cpp
index cabfee02f..819ecd15b 100644
--- a/src/thirdparty/VirtualDub/system/source/vdstl.cpp
+++ b/src/thirdparty/VirtualDub/system/source/vdstl.cpp
@@ -27,6 +27,11 @@
#include <vd2/system/error.h>
#include <vd2/system/vdstl.h>
-void VDNORETURN vdallocator_base::throw_oom() {
- throw MyMemoryError();
+void VDNORETURN vdallocator_base::throw_oom(size_t n, size_t elsize) {
+ size_t nbytes = ~(size_t)0;
+
+ if (n <= nbytes / elsize)
+ nbytes = n * elsize;
+
+ throw MyMemoryError(nbytes);
}