diff options
author | Samantha Chan | 2007-02-26 20:07:18 +0000 |
---|---|---|
committer | Samantha Chan | 2007-02-26 20:07:18 +0000 |
commit | 550af17347313f8c371ff0bd7a616af4a55f296c (patch) | |
tree | fc572e67e4d35750148feb406394f9479055077e /org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory | |
parent | d65d840c5174180361707dd2335883f60bbeadd2 (diff) | |
download | eclipse.platform.debug-550af17347313f8c371ff0bd7a616af4a55f296c.tar.gz eclipse.platform.debug-550af17347313f8c371ff0bd7a616af4a55f296c.tar.xz eclipse.platform.debug-550af17347313f8c371ff0bd7a616af4a55f296c.zip |
Bug 174722 - [Memory View] a possible out-of-bound array access in "org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java" - Backed out previous fix as it may cause performance problem
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java index 4cc449737..1f2d705b9 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 -2007 IBM Corporation and others. + * Copyright (c) 2006, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -2821,18 +2821,28 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende * @param point * @return the column index where the point is located, return -1 if column is not found. */ - private int getColumn(Point point) { + private int getColumn(Point point) + { int colCnt = fTableViewer.getTable().getColumnCount(); - if(fTableViewer.getTable().getItemCount() > 0) { - Point start, end; - TableItem item = fTableViewer.getTable().getItem(0); - for (int i=0; i<colCnt; i++) { - start = new Point(item.getBounds(i).x, item.getBounds(i).y); + + TableItem item = null; + for (int i=0; i<fTableViewer.getTable().getItemCount(); i++) + { + item = fTableViewer.getTable().getItem(i); + if (item.getData() != null) + break; + } + + if (item != null) + { + for (int i=0; i<colCnt; i++) + { + Point start = new Point(item.getBounds(i).x, item.getBounds(i).y); start = fTableViewer.getTable().toDisplay(start); - end = new Point(start.x + item.getBounds(i).width, start.y + item.getBounds(i).height); - if (start.x < point.x && end.x > point.x) { + Point end = new Point(start.x + item.getBounds(i).width, start.y + item.getBounds(i).height); + + if (start.x < point.x && end.x > point.x) return i; - } } } return -1; |