Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
ad4e0108
Commit
ad4e0108
authored
11 years ago
by
Keisuke Kuroyanagi
Browse files
Options
Downloads
Patches
Plain Diff
Fix: reading uninitialized area.
Bug: 10402083 Change-Id: I083beea29fe563b1e7739653d756b77820753e3f
parent
cdc8fcd6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.cpp
+6
-4
6 additions, 4 deletions
...st/policyimpl/dictionary/dynamic_patricia_trie_policy.cpp
with
6 additions
and
4 deletions
native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.cpp
+
6
−
4
View file @
ad4e0108
...
@@ -126,7 +126,7 @@ int DynamicPatriciaTriePolicy::getTerminalNodePositionOfWord(const int *const in
...
@@ -126,7 +126,7 @@ int DynamicPatriciaTriePolicy::getTerminalNodePositionOfWord(const int *const in
int
pos
=
getRootPosition
();
int
pos
=
getRootPosition
();
DynamicPatriciaTrieNodeReader
nodeReader
(
mDictRoot
,
getBigramsStructurePolicy
(),
DynamicPatriciaTrieNodeReader
nodeReader
(
mDictRoot
,
getBigramsStructurePolicy
(),
getShortcutsStructurePolicy
());
getShortcutsStructurePolicy
());
while
(
currentLength
<
=
length
)
{
while
(
currentLength
<
length
)
{
// When foundMatchedNode becomes true, currentLength is increased at least once.
// When foundMatchedNode becomes true, currentLength is increased at least once.
bool
foundMatchedNode
=
false
;
bool
foundMatchedNode
=
false
;
int
totalChildCount
=
0
;
int
totalChildCount
=
0
;
...
@@ -144,13 +144,15 @@ int DynamicPatriciaTriePolicy::getTerminalNodePositionOfWord(const int *const in
...
@@ -144,13 +144,15 @@ int DynamicPatriciaTriePolicy::getTerminalNodePositionOfWord(const int *const in
for
(
int
i
=
0
;
i
<
childCount
;
i
++
)
{
for
(
int
i
=
0
;
i
<
childCount
;
i
++
)
{
nodeReader
.
fetchNodeInfoFromBufferAndGetNodeCodePoints
(
pos
,
MAX_WORD_LENGTH
,
nodeReader
.
fetchNodeInfoFromBufferAndGetNodeCodePoints
(
pos
,
MAX_WORD_LENGTH
,
mergedNodeCodePoints
);
mergedNodeCodePoints
);
if
(
nodeReader
.
isDeleted
()
||
nodeReader
.
getCodePointCount
()
<=
0
)
{
const
int
nodeCodePointCount
=
nodeReader
.
getCodePointCount
();
if
(
nodeReader
.
isDeleted
()
||
nodeCodePointCount
<=
0
||
currentLength
+
nodeCodePointCount
>
length
)
{
// Skip deleted or empty node.
// Skip deleted or empty node.
pos
=
nodeReader
.
getSiblingNodePos
();
pos
=
nodeReader
.
getSiblingNodePos
();
continue
;
continue
;
}
}
bool
matched
=
true
;
bool
matched
=
true
;
for
(
int
j
=
0
;
j
<
node
Reader
.
get
CodePointCount
()
;
++
j
)
{
for
(
int
j
=
0
;
j
<
nodeCodePointCount
;
++
j
)
{
if
(
mergedNodeCodePoints
[
j
]
!=
searchCodePoints
[
currentLength
+
j
])
{
if
(
mergedNodeCodePoints
[
j
]
!=
searchCodePoints
[
currentLength
+
j
])
{
// Different code point is found.
// Different code point is found.
matched
=
false
;
matched
=
false
;
...
@@ -158,7 +160,7 @@ int DynamicPatriciaTriePolicy::getTerminalNodePositionOfWord(const int *const in
...
@@ -158,7 +160,7 @@ int DynamicPatriciaTriePolicy::getTerminalNodePositionOfWord(const int *const in
}
}
}
}
if
(
matched
)
{
if
(
matched
)
{
currentLength
+=
node
Reader
.
get
CodePointCount
()
;
currentLength
+=
nodeCodePointCount
;
if
(
length
==
currentLength
)
{
if
(
length
==
currentLength
)
{
// Terminal position is found.
// Terminal position is found.
return
nodeReader
.
getNodePos
();
return
nodeReader
.
getNodePos
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment