diff options
author | Mattias Niklewski <mattias.niklewski@sonyericsson.com> | 2011-01-18 14:27:23 +0100 |
---|---|---|
committer | Johan Redestig <johan.redestig@sonyericsson.com> | 2011-04-04 14:52:35 +0200 |
commit | 114f98a75334813fe116da3d95567db8984d45b9 (patch) | |
tree | e3de45557e954b3aa4eb5cb5b084ee8c77f774b4 /core/java/android/text/util | |
parent | c6b22e2727bd3730edd5ad72831a9bb4670d00f3 (diff) | |
download | frameworks_base-114f98a75334813fe116da3d95567db8984d45b9.zip frameworks_base-114f98a75334813fe116da3d95567db8984d45b9.tar.gz frameworks_base-114f98a75334813fe116da3d95567db8984d45b9.tar.bz2 |
Always return a valid index from Rfc822Tokenizer.findTokenEnd()
If an invalid input string ends with a backslash inside a comment
or quoted string, the returned index would be past the end of the
string. In one case this would lead to a runtime exception being
thrown from MultiAutoCompleteTextView.performValidation.
Change-Id: If629372b429716c25cdc25764f088e95d4812d57
Diffstat (limited to 'core/java/android/text/util')
-rw-r--r-- | core/java/android/text/util/Rfc822Tokenizer.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/java/android/text/util/Rfc822Tokenizer.java b/core/java/android/text/util/Rfc822Tokenizer.java index 69cf93c..68334e4 100644 --- a/core/java/android/text/util/Rfc822Tokenizer.java +++ b/core/java/android/text/util/Rfc822Tokenizer.java @@ -256,7 +256,7 @@ public class Rfc822Tokenizer implements MultiAutoCompleteTextView.Tokenizer { if (c == '"') { i++; break; - } else if (c == '\\') { + } else if (c == '\\' && i + 1 < len) { i += 2; } else { i++; @@ -275,7 +275,7 @@ public class Rfc822Tokenizer implements MultiAutoCompleteTextView.Tokenizer { } else if (c == '(') { level++; i++; - } else if (c == '\\') { + } else if (c == '\\' && i + 1 < len) { i += 2; } else { i++; |