dwrite: Avoid calling memcpy with NULL source.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52187 Signed-off-by: Esme Povirk <esme@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4ef4864672
commit
412b36e45a
|
@ -868,6 +868,7 @@ static HRESULT get_text_source_ptr(IDWriteTextAnalysisSource *source, UINT32 pos
|
||||||
*buff = malloc(length * sizeof(WCHAR));
|
*buff = malloc(length * sizeof(WCHAR));
|
||||||
if (!*buff)
|
if (!*buff)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
if (*text)
|
||||||
memcpy(*buff, *text, len*sizeof(WCHAR));
|
memcpy(*buff, *text, len*sizeof(WCHAR));
|
||||||
read = len;
|
read = len;
|
||||||
|
|
||||||
|
@ -880,6 +881,8 @@ static HRESULT get_text_source_ptr(IDWriteTextAnalysisSource *source, UINT32 pos
|
||||||
free(*buff);
|
free(*buff);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
if (!*text)
|
||||||
|
break;
|
||||||
memcpy(*buff + read, *text, min(len, length-read)*sizeof(WCHAR));
|
memcpy(*buff + read, *text, min(len, length-read)*sizeof(WCHAR));
|
||||||
read += len;
|
read += len;
|
||||||
}
|
}
|
||||||
|
@ -1009,6 +1012,7 @@ static HRESULT WINAPI dwritetextanalyzer_AnalyzeLineBreakpoints(IDWriteTextAnaly
|
||||||
|
|
||||||
if (!(buff = calloc(length, sizeof(*buff))))
|
if (!(buff = calloc(length, sizeof(*buff))))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
if (text)
|
||||||
memcpy(buff, text, len*sizeof(WCHAR));
|
memcpy(buff, text, len*sizeof(WCHAR));
|
||||||
read = len;
|
read = len;
|
||||||
|
|
||||||
|
@ -1018,6 +1022,8 @@ static HRESULT WINAPI dwritetextanalyzer_AnalyzeLineBreakpoints(IDWriteTextAnaly
|
||||||
hr = IDWriteTextAnalysisSource_GetTextAtPosition(source, read, &text, &len);
|
hr = IDWriteTextAnalysisSource_GetTextAtPosition(source, read, &text, &len);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
goto done;
|
goto done;
|
||||||
|
if (!text)
|
||||||
|
break;
|
||||||
memcpy(&buff[read], text, min(len, length-read)*sizeof(WCHAR));
|
memcpy(&buff[read], text, min(len, length-read)*sizeof(WCHAR));
|
||||||
read += len;
|
read += len;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue