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

Side by Side Diff: src/hunspell/suggestmgr.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: 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 | « no previous file | 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 #include <ctype.h> 7 #include <ctype.h>
8 8
9 #include "suggestmgr.hxx" 9 #include "suggestmgr.hxx"
10 #include "htypes.hxx" 10 #include "htypes.hxx"
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 if (ns == -1) return -1; 838 if (ns == -1) return -1;
839 if (!timer) return ns; 839 if (!timer) return ns;
840 } 840 }
841 } 841 }
842 return ns; 842 return ns;
843 } 843 }
844 844
845 // error is missing a letter it needs 845 // error is missing a letter it needs
846 int SuggestMgr::forgotchar_utf(char ** wlst, const w_char * word, int wl, int ns , int cpdsuggest) 846 int SuggestMgr::forgotchar_utf(char ** wlst, const w_char * word, int wl, int ns , int cpdsuggest)
847 { 847 {
848 w_char candidate_utf[MAXSWL]; 848 w_char candidate_utf[MAXSWL + 1];
849 char candidate[MAXSWUTF8L]; 849 char candidate[MAXSWUTF8L + 4];
groby-ooo-7-16 2012/12/12 01:19:38 does this work for 100 character pastes now? And 1
please use gerrit instead 2012/12/12 05:33:53 Words of 100 characters or more do not get passed
please use gerrit instead 2012/12/12 21:00:01 The clip of wl to be < MAXSWL happens on line 140
850 w_char * p; 850 w_char * p;
851 clock_t timelimit = clock(); 851 clock_t timelimit = clock();
852 int timer = MINTIMER; 852 int timer = MINTIMER;
853 // try inserting a tryme character at the end of the word and before every le tter 853 // try inserting a tryme character at the end of the word and before every le tter
854 for (int i = 0; i < ctryl; i++) { 854 for (int i = 0; i < ctryl; i++) {
855 memcpy (candidate_utf, word, wl * sizeof(w_char)); 855 memcpy (candidate_utf, word, wl * sizeof(w_char));
856 for (p = candidate_utf + wl; p >= candidate_utf; p--) { 856 for (p = candidate_utf + wl; p >= candidate_utf; p--) {
857 *(p + 1) = *p; 857 *(p + 1) = *p;
858 *p = ctry_utf[i]; 858 *p = ctry_utf[i];
859 u16_u8(candidate, MAXSWUTF8L, candidate_utf, wl + 1); 859 u16_u8(candidate, MAXSWUTF8L, candidate_utf, wl + 1);
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 len++; 2147 len++;
2148 i--; 2148 i--;
2149 j--; 2149 j--;
2150 } else if (result[i*(n+1) + j] == LCS_UP) { 2150 } else if (result[i*(n+1) + j] == LCS_UP) {
2151 i--; 2151 i--;
2152 } else j--; 2152 } else j--;
2153 } 2153 }
2154 free(result); 2154 free(result);
2155 return len; 2155 return len;
2156 } 2156 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698