Commit 9a59d81f authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

usp10: Correct error with ScriptLayout log2vis.

Issue found and test written by Huw Davies.
parent 851866e2
......@@ -872,11 +872,13 @@ int BIDI_ReorderL2vLevel(int level, int *pIndexs, const BYTE* plevel, int cch, B
reverse(pIndexs, ich);
}
if (newlevel > 1)
if (newlevel >= 0)
{
ich = 0;
for (; ich < cch; ich++)
if (plevel[ich] > level)
if (plevel[ich] < level)
break;
else if (plevel[ich] > level)
ich += BIDI_ReorderL2vLevel(level + 1, pIndexs + ich, plevel + ich,
cch - ich, fReverse) - 1;
}
......
......@@ -2786,6 +2786,11 @@ static void test_ScriptLayout(void)
{ 0, 0, 1, 1, 2, 2, 1, 1, 0, 1 },
{ 1, 0, 1, 2, 2, 1, 2, 1, 0, 1 },
{ 1, 2, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 2, 2, 2, 0, 0, 0, 0, 0, 0, 0 },
{ 2, 2, 2, 4, 4, 4, 1, 1, 0, 0 },
{ 1, 2, 3, 0, 3, 2, 1, 0, 0, 0 }
};
static const int expect_l2v[][10] =
{
......@@ -2802,6 +2807,11 @@ static void test_ScriptLayout(void)
{ 0, 1, 7, 6, 4, 5, 3 ,2 ,8, 9},
/**/ { 0, 1, 7, 5, 6, 4, 3 ,2 ,8, 9},
{ 1, 0, 2, 3, 4, 5, 6, 7, 8, 9},
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
{ 2, 3, 4, 5, 6, 7, 1, 0, 8, 9},
{ 2, 0, 1, 3, 5, 6, 4, 7, 8, 9}
};
static const int expect_v2l[][10] =
{
......@@ -2818,6 +2828,11 @@ static void test_ScriptLayout(void)
{ 0, 1, 7, 6, 4, 5, 3 ,2 ,8, 9},
{ 0, 1, 7, 6, 5, 3, 4 ,2 ,8, 9},
{ 1, 0, 2, 3, 4, 5, 6, 7, 8, 9},
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
{ 7, 6, 0, 1, 2, 3, 4, 5, 8, 9},
{ 1, 2, 0, 3, 6, 4, 5, 7, 8, 9}
};
int i, j, vistolog[sizeof(levels[0])], logtovis[sizeof(levels[0])];
......
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