LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File sdcv-0.4.2-zlib-return-value.patch of Package sdcv (Project Education)

Zlib can return negative value, but gulong is unsigned, so it can not catch the error state.
--- a/src/lib/lib.cpp
+++ b/src/lib/lib.cpp
@@ -751,12 +751,12 @@
 		
 	idxdatabuf = (gchar *)g_malloc(fsize);
 		
-	gulong len = gzread(in, idxdatabuf, fsize);
+	ssize_t len = gzread(in, idxdatabuf, fsize);
 	gzclose(in);
 	if (len < 0)
 		return false;
 
-	if (len != fsize)
+	if (len != (ssize_t)fsize)
 		return false;
 
   wordlist.resize(wc+1);