Fixed crash due to blind-cast of frame to rowFrame by checking the frame type first. r=karnaze sr=waterson b=88849
git-svn-id: svn://10.0.0.236/trunk@99431 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1616,6 +1616,16 @@ nsTableRowGroupFrame::FindLineContaining(nsIFrame* aFrame,
|
||||
NS_ENSURE_ARG_POINTER(aFrame);
|
||||
NS_ENSURE_ARG_POINTER(aLineNumberResult);
|
||||
|
||||
// make sure it is a rowFrame in the RowGroup
|
||||
// - it should be, but we do not validate in every case (see bug 88849)
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
if (frameType.get() != nsLayoutAtoms::tableRowFrame) {
|
||||
NS_WARNING("RowGroup contains a frame that is not a row");
|
||||
*aLineNumberResult = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsTableRowFrame* rowFrame = (nsTableRowFrame*)aFrame;
|
||||
*aLineNumberResult = rowFrame->GetRowIndex();
|
||||
|
||||
|
||||
@@ -1616,6 +1616,16 @@ nsTableRowGroupFrame::FindLineContaining(nsIFrame* aFrame,
|
||||
NS_ENSURE_ARG_POINTER(aFrame);
|
||||
NS_ENSURE_ARG_POINTER(aLineNumberResult);
|
||||
|
||||
// make sure it is a rowFrame in the RowGroup
|
||||
// - it should be, but we do not validate in every case (see bug 88849)
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
if (frameType.get() != nsLayoutAtoms::tableRowFrame) {
|
||||
NS_WARNING("RowGroup contains a frame that is not a row");
|
||||
*aLineNumberResult = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsTableRowFrame* rowFrame = (nsTableRowFrame*)aFrame;
|
||||
*aLineNumberResult = rowFrame->GetRowIndex();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user