Uploaded image for project: 'Hadoop Map/Reduce'
  1. Hadoop Map/Reduce
  2. MAPREDUCE-1166

SerialUtils.cc: dynamic allocation of arrays based on runtime variable is not portable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      In SerialUtils.cc, the following code appears:

      int len;
      if (b < -120)

      { negative = true; len = -120 - b; }

      else

      { negative = false; len = -112 - b; }

      uint8_t barr[len];

      as far as I'm aware, this is not legal in ANSI C and will be rejected by ANSI compliant compilers. Instead, this should be malloc()'d based upon the size of len and free()'d later.

        Attachments

        1. MAPREREDUCE-1166.patch
          0.5 kB
          Allen Wittenauer

          Activity

            People

            • Assignee:
              aw Allen Wittenauer
              Reporter:
              aw Allen Wittenauer
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: