Bug 92443 - 'int' comparison with 'unsigned int' in for() for the array index
Summary: 'int' comparison with 'unsigned int' in for() for the array index
Status: RESOLVED FIXED
Alias: None
Product: p11-glue
Classification: Unclassified
Component: p11-kit (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Stef Walter
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-13 06:36 UTC by Pankaj
Modified: 2015-10-19 09:19 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
p11-kit-0.23.1-array patch (375 bytes, text/plain)
2015-10-13 06:36 UTC, Pankaj
Details

Description Pankaj 2015-10-13 06:36:42 UTC
Created attachment 118848 [details]
p11-kit-0.23.1-array patch

Hi ,

The type of the index variable 'i' is different from the type of compared variable in for loop ('int' and 'unsigned int').
It would result in infinite loops.
the respective patch has been attached ,please review it.
===========================================================
diff -Naur a/p11-kit-0.23.1/common/array.c b/p11-kit-0.23.1/common/array.c
--- a/p11-kit-0.23.1/common/array.c	2014-11-12 16:28:50.000000000 +0530
+++ b/p11-kit-0.23.1/common/array.c	2015-10-13 11:35:28.461948457 +0530
@@ -118,7 +118,7 @@
 void
 p11_array_clear (p11_array *array)
 {
-	int i;
+	unsigned int i;
 
 	if (array->destroyer) {
 		for (i = 0; i < array->num; i++)

Thanks
Pankaj Sharma
Comment 1 Stef Walter 2015-10-19 09:19:57 UTC
This patch does not apply to git master. I manually recreated the change. I hope that it's correct.

In the future please prepare your patches on git master with the 'git format-patch -1' command. 

Thanks!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.