Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(658)

Side by Side Diff: src/hunspell/hunspell.cxx

Issue 11442040: Fix array-out-of-bounds error in hunspell (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/hunspell.git@master
Patch Set: Merge with master Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « google.patch ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "license.hunspell" 1 #include "license.hunspell"
2 #include "license.myspell" 2 #include "license.myspell"
3 3
4 #include <stdlib.h> 4 #include <stdlib.h>
5 #include <string.h> 5 #include <string.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 7
8 #include "hunspell.hxx" 8 #include "hunspell.hxx"
9 #include "hunspell.h" 9 #include "hunspell.h"
10 #ifndef HUNSPELL_CHROME_CLIENT 10 #ifndef HUNSPELL_CHROME_CLIENT
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 *p = '\0'; 130 *p = '\0';
131 return 0; 131 return 0;
132 } 132 }
133 133
134 strncpy(dest, (char *) q, nl); 134 strncpy(dest, (char *) q, nl);
135 *(dest + nl) = '\0'; 135 *(dest + nl) = '\0';
136 nl = strlen(dest); 136 nl = strlen(dest);
137 if (utf8) { 137 if (utf8) {
138 *nc = u8_u16(dest_utf, MAXWORDLEN, dest); 138 *nc = u8_u16(dest_utf, MAXWORDLEN, dest);
139 // don't check too long words 139 // don't check too long words
140 if (*nc >= MAXWORDLEN) return 0; 140 // TODO(rouslan): Remove the interim change below when this patch lands:
141 // http://sf.net/tracker/?func=detail&aid=3595024&group_id=143754&atid=756 395.
142 if (*nc >= MAXWORDLEN - 1) return 0;
141 if (*nc == -1) { // big Unicode character (non BMP area) 143 if (*nc == -1) { // big Unicode character (non BMP area)
142 *pcaptype = NOCAP; 144 *pcaptype = NOCAP;
143 return nl; 145 return nl;
144 } 146 }
145 *pcaptype = get_captype_utf8(dest_utf, *nc, langnum); 147 *pcaptype = get_captype_utf8(dest_utf, *nc, langnum);
146 } else { 148 } else {
147 *pcaptype = get_captype(dest, nl, csconv); 149 *pcaptype = get_captype(dest, nl, csconv);
148 *nc = nl; 150 *nc = nl;
149 } 151 }
150 return nl; 152 return nl;
(...skipping 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after
2047 2049
2048 /* remove word from the run-time dictionary */ 2050 /* remove word from the run-time dictionary */
2049 2051
2050 int Hunspell_remove(Hunhandle *pHunspell, const char * word) { 2052 int Hunspell_remove(Hunhandle *pHunspell, const char * word) {
2051 return ((Hunspell*)pHunspell)->remove(word); 2053 return ((Hunspell*)pHunspell)->remove(word);
2052 } 2054 }
2053 2055
2054 void Hunspell_free_list(Hunhandle *, char *** slst, int n) { 2056 void Hunspell_free_list(Hunhandle *, char *** slst, int n) {
2055 freelist(slst, n); 2057 freelist(slst, n);
2056 } 2058 }
OLDNEW
« no previous file with comments | « google.patch ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698