summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-07-19 14:58:51 +0000
committerArmin Le Grand <alg@apache.org>2012-07-19 14:58:51 +0000
commit9397af20378af3be3401d883a7adacd54792471d (patch)
tree6b00acb508ae6b998060adf818076cb1ce7d71c4
parente51ea342dad1655ff5370f35e6c73edee5debfc8 (diff)
mythes: fix some warnings
Patch by: Michael Stahl
Notes
Notes: prefer: 91d95fa91b017f821cc0ed8fa7838a019202edb2
-rw-r--r--mythes/mythes-1.2.0-overflow.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/mythes/mythes-1.2.0-overflow.patch b/mythes/mythes-1.2.0-overflow.patch
new file mode 100644
index 000000000000..d69433762bea
--- /dev/null
+++ b/mythes/mythes-1.2.0-overflow.patch
@@ -0,0 +1,24 @@
+--- misc/mythes-1.2.0/mythes.cxx 2010-02-27 16:52:52.000000000 +0100
++++ misc/build/mythes-1.2.0/mythes.cxx 2011-05-18 16:22:49.125014204 +0200
+@@ -4,6 +4,8 @@
+ #include <stdlib.h>
+ #include <errno.h>
+
++#include <limits>
++
+ #include "mythes.hxx"
+
+ // some basic utility routines
+@@ -204,6 +206,12 @@
+ return 0;
+ }
+ int nmeanings = atoi(buf+np+1);
++ if ((nmeanings < 0) ||
++ ((::std::numeric_limits<size_t>::max() / sizeof(mentry)) < nmeanings))
++ {
++ free(buf);
++ return 0;
++ }
+ *pme = (mentry*) malloc( nmeanings * sizeof(mentry) );
+ if (!(*pme)) {
+ free(buf);