INN commit: trunk (4 files)
INN Commit
rra at isc.org
Sat Nov 4 15:23:34 UTC 2017
Date: Saturday, November 4, 2017 @ 08:23:34
Author: iulius
Revision: 10183
Enforce new GCC 6 warning options; fix possible NULL-pointer dereferences
Add the following warning options:
-Wnull-dereference
-Wshift-overflow=2
-Wduplicated-cond
Do not explicitly mention -Wendif-labels because it is enabled by default.
Also use -O3 instead of -O2.
Fix in timehash and buffindexed code possible NULL-pointer dereferences.
Modified:
trunk/configure.ac
trunk/doc/pod/news.pod
trunk/storage/buffindexed/buffindexed.c
trunk/storage/timehash/timehash.c
-----------------------------------+
configure.ac | 13 +++++++------
doc/pod/news.pod | 4 ++++
storage/buffindexed/buffindexed.c | 10 ++++++++++
storage/timehash/timehash.c | 13 ++++++++++---
4 files changed, 31 insertions(+), 9 deletions(-)
Modified: configure.ac
===================================================================
--- configure.ac 2017-10-16 04:17:01 UTC (rev 10182)
+++ configure.ac 2017-11-04 15:23:34 UTC (rev 10183)
@@ -710,10 +710,10 @@
dnl warn on system headers. The warnings below are in the same order as
dnl they're listed in the gcc manual.
dnl
-dnl Last checked against gcc 4.7.4 (2014-06-12).
+dnl Last checked against gcc 6.3.0 (2017-11-04).
dnl
dnl Add -g because when building with warnings, one generally also wants the
-dnl debugging information, and add -O2 because gcc won't find some warnings
+dnl debugging information, and add -O3 because gcc won't find some warnings
dnl without optimization turned on. Add -DDEBUG=1 so that we'll also
dnl compile all debugging code and check it as well.
dnl
@@ -729,14 +729,15 @@
dnl -Wunreachable-code, -Wstack-protector, -Wdeclaration-after-statement
m4_foreach_w(
[flag],
- [-g -O2 -DDEBUG=1 -Werror -Wall -Wextra -Wformat=2
- -Winit-self -Wmissing-include-dirs
- -Wsync-nand -Wendif-labels -Wtrampolines -Wpointer-arith
+ [-g -O3 -DDEBUG=1 -Werror -Wall -Wextra -Wformat=2
+ -Wnull-dereference -Winit-self -Wmissing-include-dirs
+ -Wshift-overflow=2
+ -Wsync-nand -Wmissing-format-attribute -Wduplicated-cond
+ -Wtrampolines -Wpointer-arith
-Wbad-function-cast -Wcast-align -Wwrite-strings
-Wjump-misses-init -Wstrict-prototypes
-Wold-style-definition
-Wmissing-prototypes -Wmissing-declarations
- -Wmissing-format-attribute
-Wnormalized=nfc -Wnested-externs -Winline
-Winvalid-pch -Wvla -Wno-unknown-warning-option],
[INN_PROG_CC_FLAG(flag, [CC_WARNINGS="${CC_WARNINGS} flag"], [])])
Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod 2017-10-16 04:17:01 UTC (rev 10182)
+++ doc/pod/news.pod 2017-11-04 15:23:34 UTC (rev 10183)
@@ -42,6 +42,10 @@
daily Usenet reports were appearing as a mere letter; all of them are
now properly converted to meaningful words.
+=item *
+
+Other minor bug fixes and documentation improvements.
+
=back
=head1 Changes in 2.6.1
Modified: storage/buffindexed/buffindexed.c
===================================================================
--- storage/buffindexed/buffindexed.c 2017-10-16 04:17:01 UTC (rev 10182)
+++ storage/buffindexed/buffindexed.c 2017-11-04 15:23:34 UTC (rev 10183)
@@ -1724,6 +1724,12 @@
for (gdb = groupdatablock[i] ; gdb != NULL ; gdb = gdb->next) {
ov = gdb->datablk;
ovbuff = getovbuff(ov);
+ if (ovbuff == NULL) {
+ warn("buffindexed: ovgroupmmap could not get ovbuff block for new, %d, %d", ov.index, ov.blocknum);
+ free(gdb);
+ ovgroupunmap();
+ return false;
+ }
offset = ovbuff->base + OV_OFFSET(ov.blocknum);
pagefudge = offset % pagesize;
mmapoffset = offset - pagefudge;
@@ -1860,6 +1866,10 @@
search->gdb.datablk.blocknum = srchov.blocknum;
search->gdb.datablk.index = srchov.index;
ovbuff = getovbuff(srchov);
+ if (ovbuff == NULL) {
+ warn("buffindexed: ovsearch could not get ovbuff block for new, %d, %d, %ld", srchov.index, srchov.blocknum, *artnum);
+ return false;
+ }
offset = ovbuff->base + OV_OFFSET(srchov.blocknum);
pagefudge = offset % pagesize;
mmapoffset = offset - pagefudge;
Modified: storage/timehash/timehash.c
===================================================================
--- storage/timehash/timehash.c 2017-10-16 04:17:01 UTC (rev 10182)
+++ storage/timehash/timehash.c 2017-11-04 15:23:34 UTC (rev 10183)
@@ -121,8 +121,9 @@
n = sscanf(path, "time-%02x/%02x/%02x/%04x-%04x",
&tclass, &t1, &t2, &seqnum, &t3);
- if (n != 5)
- return (TOKEN *)NULL;
+ if (n != 5) {
+ return (TOKEN *)NULL;
+ }
now = ((t1 << 16) & 0xff0000) | ((t2 << 8) & 0xff00) | ((t3 << 16) & 0xff000000) | (t3 & 0xff);
class = tclass;
token = MakeToken(now, seqnum, class, (TOKEN *)NULL);
@@ -435,6 +436,7 @@
ARTHANDLE *art;
int seqnum;
size_t length;
+ TOKEN *nexttoken;
length = strlen(innconf->patharticles) + 32;
path = xmalloc(length);
@@ -529,7 +531,12 @@
newpriv->secde = priv.secde;
newpriv->terde = priv.terde;
snprintf(path, length, "%s/%s/%s/%s", priv.topde->d_name, priv.secde->d_name, priv.terde->d_name, de->d_name);
- art->token = PathToToken(path);
+ nexttoken = PathToToken(path);
+ if (nexttoken == (TOKEN *)NULL) {
+ free(path);
+ return NULL;
+ }
+ art->token = nexttoken;
BreakToken(*art->token, &(art->arrived), &seqnum);
free(path);
return art;
More information about the inn-committers
mailing list