From 8fa6503feb1954d8c11a0591a567e6acedf7abe9 Mon Sep 17 00:00:00 2001 From: Fabrice Di Meglio Date: Mon, 29 Aug 2011 18:38:27 -0700 Subject: [PATCH] Fix bug #5233207 android.graphics.cts.PaintTest#testBreakText fails on IRK56F trygon-userdebug - Paint.breakText() API was regressing on the argument validation: a count < 0 is a valid one Change-Id: I6d09294ee9f21901ba00017ce0d73f757fc7b147 --- graphics/java/android/graphics/Paint.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java index cde997e9dd8ee..048d09cf03427 100644 --- a/graphics/java/android/graphics/Paint.java +++ b/graphics/java/android/graphics/Paint.java @@ -1349,7 +1349,7 @@ public class Paint { if (text == null) { throw new IllegalArgumentException("text cannot be null"); } - if ((index | count) < 0 || index + count > text.length) { + if (index < 0 || text.length - index < Math.abs(count)) { throw new ArrayIndexOutOfBoundsException(); }