Skip to content

Commit 44c5751

Browse files
committed
bugfix version 6 hu algrithm, arr index safe check
1 parent 13ca9b7 commit 44c5751

File tree

4 files changed

+585
-9
lines changed

4 files changed

+585
-9
lines changed

mahjong/mahjongHu_checker.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ class MjMapTbV6 {
327327
if (i < nCount) {
328328
byDelIndex = min(i, int(nCount));
329329
}
330-
} else {
330+
}
331+
else {
331332
byDelIndex = i;
332333
}
333334
nVal |= (int)(byTemp - 3) << (2 * i);
@@ -340,6 +341,9 @@ class MjMapTbV6 {
340341
if (nNum == 0)
341342
continue;
342343

344+
if (nVal >= sizeof(m_dError) / sizeof(m_dError[0]))
345+
return false;
346+
343347
if (m_dError[nVal])
344348
return false;
345349

0 commit comments

Comments
 (0)