dwrite: Avoid possible out-of-bounds cluster metrics access.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45535
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-08-13 11:22:06 +03:00 committed by Alexandre Julliard
parent 8ad509ed70
commit 470ed3c559
1 changed files with 1 additions and 1 deletions

View File

@ -2089,7 +2089,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
*/
if (layout->len == 0)
hr = layout_set_dummy_line_metrics(layout, 0);
else if (layout->clustermetrics[layout->cluster_count - 1].isNewline)
else if (layout->cluster_count && layout->clustermetrics[layout->cluster_count - 1].isNewline)
hr = layout_set_dummy_line_metrics(layout, layout->len - 1);
if (FAILED(hr))
return hr;