diff options
author | Yunlian Jiang <yunlian@google.com> | 2016-09-22 09:05:41 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-09-22 11:16:51 -0700 |
commit | 4598b132f8815ad899e9506dbdfec2e177242b48 (patch) | |
tree | a6a0b9811a2b4cdc443b1b36502add5164a84881 | |
parent | 91c9393de517beb79e86272048d9c7d75a94065f (diff) | |
download | toolchain-utils-4598b132f8815ad899e9506dbdfec2e177242b48.tar.gz |
cros-utils: fix an out of bound error.
The input rgb2short can reach to 255. When the value exceeds 250,
it causes out of bound error. This CL fixes that.
BUG=chromium:649374
TEST=The out of bound error is fixed.
Change-Id: Iee31337e82907e1803a84b5837542733bb224e8f
Reviewed-on: https://chrome-internal-review.googlesource.com/289536
Commit-Ready: Yunlian Jiang <yunlian@google.com>
Tested-by: Yunlian Jiang <yunlian@google.com>
Reviewed-by: Caroline Tice <cmtice@google.com>
-rw-r--r-- | cros_utils/misc.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cros_utils/misc.py b/cros_utils/misc.py index ef8e0830..6c7d2909 100644 --- a/cros_utils/misc.py +++ b/cros_utils/misc.py @@ -563,7 +563,7 @@ def rgb2short(r, g, b): greencolor = [255, 118, 82, 46, 10 ] if g == 0: - return redcolor[r/50] + return redcolor[r/52] if r == 0: - return greencolor[g/50] + return greencolor[g/52] return 4 |