@cryptotaxi247 / netdata-1 / commits / 959a5e7d0

fixed the bug where randomly chart dimensions were hidden - it was caused due to unitialized use of allocated space

Costa Tsaousis (ktsaou) committed Dec 18, 2015 at 21:08 UTC 959a5e7d04375933eeb3d6d01be47ae445cf7582
3 files changed +13 -3
netdata-installer.sh
+1 -1
@@ -105,7 +105,7 @@ run ./configure \
105 --sysconfdir="${NETDATA_PREFIX}/etc" \
106 --localstatedir="${NETDATA_PREFIX}/var" \
107 --with-zlib --with-math --with-user=netdata \
108 - CFLAGS="-O2" || exit 1
108 + CFLAGS="-O3" || exit 1
109
110 # remove the build_error hook
111 trap - EXIT
src/main.c
+4
@@ -430,6 +430,10 @@ int main(int argc, char **argv)
430 // catch all signals
431 for (i = 1 ; i < 65 ;i++) {
432 switch(i) {
433 + case SIGKILL: // not catchable
434 + case SIGSTOP: // not catchable
435 + break;
436 +
437 case SIGSEGV:
438 case SIGFPE:
439 case SIGCHLD:
src/rrd2json.c
+8 -2
@@ -1082,6 +1082,13 @@ static RRDR *rrdr_create(RRDSET *st, int n)
1082 r->od = malloc(r->d * sizeof(uint8_t));
1083 if(unlikely(!r->od)) goto cleanup;
1084
1085 + // set the hidden flag on hidden dimensions
1086 + int c;
1087 + for(c = 0, rd = st->dimensions ; rd ; c++, rd = rd->next) {
1088 + if(unlikely(rd->flags & RRDDIM_FLAG_HIDDEN)) r->od[c] = RRDR_HIDDEN;
1089 + else r->od[c] = 0;
1090 + }
1091 +
1092 r->c = -1;
1093
1094 r->group = 1;
@@ -1346,11 +1353,10 @@ RRDR *rrd2rrdr(RRDSET *st, long points, long long after, long long before, int g
1353 calculated_number *cn = rrdr_line_values(r);
1354 uint8_t *co = rrdr_line_options(r);
1355
1349 - for(rd = st->dimensions, c = 0 ; likely(rd && c < dimensions) ; rd = rd->next, c++) {
1356 + for(rd = st->dimensions, c = 0 ; rd && c < dimensions ; rd = rd->next, c++) {
1357
1358 // update the dimension options
1359 if(likely(found_non_zero[c])) r->od[c] |= RRDR_NONZERO;
1353 - if(unlikely(rd->flags & RRDDIM_FLAG_HIDDEN)) r->od[c] |= RRDR_HIDDEN;
1360
1361 // store the specific point options
1362 co[c] = group_options[c];