mirror of https://github.com/encounter/SDL.git
Fix divide-by-zero when videodata->ime_candpgsize is zero. We're seeing this happen in Dota in the wild.
This commit is contained in:
parent
66555f6115
commit
a4dbf56574
|
@ -834,7 +834,11 @@ IME_GetCandidateList(HIMC himc, SDL_VideoData *videodata)
|
||||||
videodata->ime_candpgsize = i - page_start;
|
videodata->ime_candpgsize = i - page_start;
|
||||||
} else {
|
} else {
|
||||||
videodata->ime_candpgsize = SDL_min(cand_list->dwPageSize, MAX_CANDLIST);
|
videodata->ime_candpgsize = SDL_min(cand_list->dwPageSize, MAX_CANDLIST);
|
||||||
page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize;
|
if (videodata->ime_candpgsize > 0) {
|
||||||
|
page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize;
|
||||||
|
} else {
|
||||||
|
page_start = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SDL_memset(&videodata->ime_candidates, 0, sizeof(videodata->ime_candidates));
|
SDL_memset(&videodata->ime_candidates, 0, sizeof(videodata->ime_candidates));
|
||||||
for (i = page_start, j = 0; (DWORD)i < cand_list->dwCount && j < (int)videodata->ime_candpgsize; i++, j++) {
|
for (i = page_start, j = 0; (DWORD)i < cand_list->dwCount && j < (int)videodata->ime_candpgsize; i++, j++) {
|
||||||
|
|
Loading…
Reference in New Issue