From bb8c841e909a2fb967db2ad3b9f8b058f9b849e8 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Fri, 29 May 2015 18:48:38 -0700 Subject: Terminate loop properly when cursor window is full. The existing code exits the column-filling loop immediately but may continue to try to fill rows. Ordinarily this should fail too but it's possible for the process to continue and then blow up a little later. Fixed this problem by exiting the row- filling loop promptly. Bug: 21406130 Change-Id: Ifab59188d5d1b40f3c1f5c97604dd48da71bf37b --- core/java/android/database/DatabaseUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/java') diff --git a/core/java/android/database/DatabaseUtils.java b/core/java/android/database/DatabaseUtils.java index e61664c..227066d 100644 --- a/core/java/android/database/DatabaseUtils.java +++ b/core/java/android/database/DatabaseUtils.java @@ -270,7 +270,7 @@ public class DatabaseUtils { window.setStartPosition(position); window.setNumColumns(numColumns); if (cursor.moveToPosition(position)) { - do { + rowloop: do { if (!window.allocRow()) { break; } @@ -307,7 +307,7 @@ public class DatabaseUtils { } if (!success) { window.freeLastRow(); - break; + break rowloop; } } position += 1; -- cgit v1.1