am 505ffe36: Merge "Check bounds on CharSequence drawText methods" into lmp-mr1-dev
* commit '505ffe3633f45778e493e23ad8c163f09ed1dbb5': Check bounds on CharSequence drawText methods
This commit is contained in:
@@ -885,6 +885,9 @@ class GLES20Canvas extends HardwareCanvas {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawText(CharSequence text, int start, int end, float x, float y, Paint paint) {
|
public void drawText(CharSequence text, int start, int end, float x, float y, Paint paint) {
|
||||||
|
if ((start | end | (end - start) | (text.length() - end)) < 0) {
|
||||||
|
throw new IndexOutOfBoundsException();
|
||||||
|
}
|
||||||
if (text instanceof String || text instanceof SpannedString ||
|
if (text instanceof String || text instanceof SpannedString ||
|
||||||
text instanceof SpannableString) {
|
text instanceof SpannableString) {
|
||||||
nDrawText(mRenderer, text.toString(), start, end, x, y, paint.mBidiFlags,
|
nDrawText(mRenderer, text.toString(), start, end, x, y, paint.mBidiFlags,
|
||||||
|
|||||||
@@ -1710,6 +1710,9 @@ public class Canvas {
|
|||||||
*/
|
*/
|
||||||
public void drawText(@NonNull CharSequence text, int start, int end, float x, float y,
|
public void drawText(@NonNull CharSequence text, int start, int end, float x, float y,
|
||||||
@NonNull Paint paint) {
|
@NonNull Paint paint) {
|
||||||
|
if ((start | end | (end - start) | (text.length() - end)) < 0) {
|
||||||
|
throw new IndexOutOfBoundsException();
|
||||||
|
}
|
||||||
if (text instanceof String || text instanceof SpannedString ||
|
if (text instanceof String || text instanceof SpannedString ||
|
||||||
text instanceof SpannableString) {
|
text instanceof SpannableString) {
|
||||||
native_drawText(mNativeCanvasWrapper, text.toString(), start, end, x, y,
|
native_drawText(mNativeCanvasWrapper, text.toString(), start, end, x, y,
|
||||||
|
|||||||
Reference in New Issue
Block a user