sdcv/sdcv-zlib-return-value.patch

19 lines
444 B
Diff
Raw Normal View History

2011-01-13 21:00:55 +00:00
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);