Commit eaf7beca authored by Dylan Smith's avatar Dylan Smith Committed by Alexandre Julliard

richedit: Null pointer check missing on optional parameter.

The function ME_FindRunInRow uses two parameters to return values by reference, and treated these parameters as if they were optional except for the start of the function which set *pbCaretAtEnd without checking to see if was a NULL pointer.
parent cc23d3ef
...@@ -975,13 +975,13 @@ static ME_DisplayItem *ME_FindRunInRow(ME_TextEditor *editor, ME_DisplayItem *pR ...@@ -975,13 +975,13 @@ static ME_DisplayItem *ME_FindRunInRow(ME_TextEditor *editor, ME_DisplayItem *pR
pNext = ME_FindItemFwd(pRow, diRunOrStartRow); pNext = ME_FindItemFwd(pRow, diRunOrStartRow);
assert(pNext->type == diRun); assert(pNext->type == diRun);
pLastRun = pNext; pLastRun = pNext;
*pbCaretAtEnd = FALSE; if (pbCaretAtEnd) *pbCaretAtEnd = FALSE;
if (pOffset) *pOffset = 0;
do { do {
int run_x = pNext->member.run.pt.x; int run_x = pNext->member.run.pt.x;
int width = pNext->member.run.nWidth; int width = pNext->member.run.nWidth;
if (x < run_x) if (x < run_x)
{ {
if (pOffset) *pOffset = 0;
return pNext; return pNext;
} }
if (x >= run_x && x < run_x+width) if (x >= run_x && x < run_x+width)
...@@ -1001,12 +1001,9 @@ static ME_DisplayItem *ME_FindRunInRow(ME_TextEditor *editor, ME_DisplayItem *pR ...@@ -1001,12 +1001,9 @@ static ME_DisplayItem *ME_FindRunInRow(ME_TextEditor *editor, ME_DisplayItem *pR
if ((pLastRun->member.run.nFlags & MERF_ENDPARA) == 0) if ((pLastRun->member.run.nFlags & MERF_ENDPARA) == 0)
{ {
pNext = ME_FindItemFwd(pNext, diRun); pNext = ME_FindItemFwd(pNext, diRun);
if (pbCaretAtEnd) *pbCaretAtEnd = 1; if (pbCaretAtEnd) *pbCaretAtEnd = TRUE;
if (pOffset) *pOffset = 0;
return pNext; return pNext;
} else { } else {
if (pbCaretAtEnd) *pbCaretAtEnd = 0;
if (pOffset) *pOffset = 0;
return pLastRun; return pLastRun;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment