[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[developers] Valgrind bug in minibidi.c
- To: developer at arabeyes dot org
- Subject: [developers] Valgrind bug in minibidi.c
- From: Pierre Vullo <pierre dot vullo at os4i dot com>
- Date: Tue, 20 Oct 2009 10:49:41 +0200
- Cc: gregory dot thiemonge at openwide dot fr
Hello,
I would like to submit a bug and a possible patch. I discovered the bug
with Valgrind.
In minibidi.c, in function "flipThisRun" , level[i] was read while
testing its value, even if i was out of range. Switching the tests
resolves the problem.
Always in minibidi.c, "doBidi" . levels[i] was read when "i" was out of
range (i=count).
Also, "tempType = levels[j];" was not used.
Please let me know if you agree with this modifications.
Regards.
==patch==
diff --git a/src/minibidi.c b/src/minibidi.c
index d64501f..584bffc 100644
--- a/src/minibidi.c
+++ b/src/minibidi.c
@@ -98,7 +98,7 @@ void flipThisRun(BLOCKTYPE from, unsigned char* level,
int max, int count)
tlevel = max;
i = j = findIndexOfRun(level, i, count, max);
/* find the end of the run */
- while((tlevel <= level[i]) && (i < count))
+ while((i < count)&&(tlevel <= level[i]))
{
i++;
}
@@ -1461,11 +1461,9 @@ int doBidi(BLOCKTYPE line, int count, int
applyShape, int reorderCombining)
{
tempType = levels[j];
i=j;
- while((i++ < count) && (levels[i] == tempType));
+ while((++i < count) && (levels[i] == tempType));
doShape(line, shapeTo, j, i);
j=i;
- tempType = levels[j];
-
}
}
j++;
--
Pierre Vullo
os4i.com