Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-820

cf-monitord HISTOGRAM array initialization

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.5.3
    • Component/s: cf-monitord
    • Labels:
      None

      Description

      For some reason on Fedora 19 cf-monitord crashed every time with a segmentation fault. Debugging this problem on Fedora (cfengine-3.3.0-3.fc19.x86_64) lead to the initialization of the HISTOGRAM array. It seems the array indices are mixed up. Even though that does not cause an error when I'm manually compiling (so only the packaged version is affected) the statement seems wrong. I've seen this in the current code too:

      cfengine-3.3.0/src/env_monitor.c
      or
      cfengine-3.5.1/cf-monitord/env_monitor.c

      The array is defined as:

      static double HISTOGRAM[CF_OBSERVABLES][7][CF_GRAINS];

      Though it is initialized as follows. The upper limit of i should be CF_OBSERVABLES and of j it should be 7.

      for (i = 0; i < 7; i++)
      {
      for (j = 0; j < CF_OBSERVABLES; j++)
      {
      for (k = 0; k < CF_GRAINS; k++)

      { HISTOGRAM[i][j][k] = 0; }

      }
      }

        Attachments

          Activity

            People

            • Assignee:
              a10025 Volker Hilsheimer (Inactive)
              Reporter:
              hawk@tbi Richard Neuboeck
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel