incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1363395 - in /incubator/ooo/trunk/ext_libraries/hunspell: hunspell-1.3.2-overflow.patch makefile.mk
Date Thu, 19 Jul 2012 15:52:39 GMT
Author: alg
Date: Thu Jul 19 15:52:39 2012
New Revision: 1363395

URL: http://svn.apache.org/viewvc?rev=1363395&view=rev
Log:
hunspell: fix warnings
Patch by: Michael Stahl

Added:
    incubator/ooo/trunk/ext_libraries/hunspell/hunspell-1.3.2-overflow.patch
Modified:
    incubator/ooo/trunk/ext_libraries/hunspell/makefile.mk

Added: incubator/ooo/trunk/ext_libraries/hunspell/hunspell-1.3.2-overflow.patch
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/ext_libraries/hunspell/hunspell-1.3.2-overflow.patch?rev=1363395&view=auto
==============================================================================
--- incubator/ooo/trunk/ext_libraries/hunspell/hunspell-1.3.2-overflow.patch (added)
+++ incubator/ooo/trunk/ext_libraries/hunspell/hunspell-1.3.2-overflow.patch Thu Jul 19 15:52:39
2012
@@ -0,0 +1,91 @@
+--- misc/hunspell-1.3.2/src/hunspell/affixmgr.cxx	2010-02-27 12:59:53.000000000 +0100
++++ misc/build/hunspell-1.3.2/src/hunspell/affixmgr.cxx	2011-05-18 16:29:45.919141893 +0200
+@@ -6,6 +6,8 @@
+ #include <stdio.h>
+ #include <ctype.h>
+ 
++#include <limits>
++
+ #include "affixmgr.hxx"
+ #include "affentry.hxx"
+ #include "langnum.hxx"
+@@ -4000,7 +4002,10 @@
+              case 3: { 
+                        np++;
+                        numents = atoi(piece); 
+-                       if (numents == 0) {
++                       if ((numents <= 0) ||
++                           ((::std::numeric_limits<size_t>::max()
++                                / sizeof(struct affentry)) < numents))
++                       {
+                            char * err = pHMgr->encode_flag(aflag);
+                            if (err) {
+                                 HUNSPELL_WARNING(stderr, "error: line %d: bad entry number\n",
+--- misc/hunspell-1.3.2/src/tools/munch.c	2010-02-27 21:49:49.000000000 +0100
++++ misc/build/hunspell-1.3.2/src/tools/munch.c	2011-05-18 15:53:53.427072106 +0200
+@@ -4,6 +4,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdlib.h>
++#include <stdint.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+@@ -233,10 +233,19 @@
+                     case 1: { achar = *piece; break; }
+                     case 2: { if (*piece == 'Y') ff = XPRODUCT; break; }
+                     case 3: { numents = atoi(piece); 
+-                              ptr = malloc(numents * sizeof(struct affent));
+-                              ptr->achar = achar;
+-                              ptr->xpflg = ff;
+-	                      fprintf(stderr,"parsing %c entries %d\n",achar,numents);
++                              if ((numents < 0) ||
++                                  ((SIZE_MAX/sizeof(struct affent)) < numents))
++                              {
++                                 fprintf(stderr,
++                                     "Error: too many entries: %d\n", numents);
++                                 numents = 0;
++                              } else {
++                                 ptr = malloc(numents * sizeof(struct affent));
++                                 ptr->achar = achar;
++                                 ptr->xpflg = ff;
++                                 fprintf(stderr,"parsing %c entries %d\n",
++                                         achar,numents);
++                              }
+                               break;
+                             }
+ 		    default: break;
+--- misc/hunspell-1.3.2/src/tools/unmunch.c	2010-02-23 15:53:29.000000000 +0100
++++ misc/build/hunspell-1.3.2/src/tools/unmunch.c	2011-05-18 20:53:43.843599726 +0200
+@@ -6,6 +6,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdlib.h>
++#include <stdint.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+@@ -158,10 +159,19 @@
+                     case 1: { achar = *piece; break; }
+                     case 2: { if (*piece == 'Y') ff = XPRODUCT; break; }
+                     case 3: { numents = atoi(piece); 
+-                              ptr = malloc(numents * sizeof(struct affent));
+-                              ptr->achar = achar;
+-                              ptr->xpflg = ff;
+-	                      fprintf(stderr,"parsing %c entries %d\n",achar,numents);
++                              if ((numents < 0) ||
++                                  ((SIZE_MAX/sizeof(struct affent)) < numents))
++                              {
++                                 fprintf(stderr,
++                                     "Error: too many entries: %d\n", numents);
++                                 numents = 0;
++                              } else {
++                                 ptr = malloc(numents * sizeof(struct affent));
++                                 ptr->achar = achar;
++                                 ptr->xpflg = ff;
++                                 fprintf(stderr,"parsing %c entries %d\n",
++                                         achar,numents);
++                              }
+                               break;
+                             }
+ 		    default: break;

Modified: incubator/ooo/trunk/ext_libraries/hunspell/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/ext_libraries/hunspell/makefile.mk?rev=1363395&r1=1363394&r2=1363395&view=diff
==============================================================================
--- incubator/ooo/trunk/ext_libraries/hunspell/makefile.mk (original)
+++ incubator/ooo/trunk/ext_libraries/hunspell/makefile.mk Thu Jul 19 15:52:39 2012
@@ -42,9 +42,10 @@ all:
 TARFILE_NAME=hunspell-1.3.2
 TARFILE_MD5=3121aaf3e13e5d88dfff13fb4a5f1ab8
 
-PATCH_FILES=					\
-    hunspell-solaris.patch		\
-    hunspell-bash.patch
+PATCH_FILES=					    \
+    hunspell-solaris.patch		    \
+    hunspell-bash.patch             \
+    hunspell-1.3.2-overflow.patch
 
 .IF "$(GUI)"=="UNX"
 



Mime
View raw message