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

[Gridmix] A potential divide by zero in AvgRecordFactory

Add voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      In the file gridmix/AvgRecordFactory.java, one of the class's constructor has the following code:

      public AvgRecordFactory(long targetBytes, long targetRecords,
            Configuration conf, int minSpilledBytes) {
          this.targetBytes = targetBytes;
          this.targetRecords = targetRecords <= 0 && this.targetBytes >= 0
            ? Math.max(1,
                this.targetBytes / conf.getInt(GRIDMIX_MISSING_REC_SIZE, 64 * 1024))
            : targetRecords;
          final long tmp = this.targetBytes / this.targetRecords;
          ...
      }
      

      The check in the code targetRecords <= 0 && this.targetBytes >= 0 is not sufficient: when targetRecords == 0 && targetBytes < 0, we can bypass the protection checking and set this.targetRecords to zero, leading to a divide by zero problem when computing tmp.

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            Yiyuan GUO Yiyuan GUO

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h

                Slack

                  Issue deployment