[ https://issues.apache.org/jira/browse/MAPREDUCE-7346?focusedWorklogId=601557&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-601557 ]
ASF GitHub Bot logged work on MAPREDUCE-7346: --------------------------------------------- Author: ASF GitHub Bot Created on: 25/May/21 07:12 Start Date: 25/May/21 07:12 Worklog Time Spent: 10m Work Description: yiyuaner opened a new pull request #3047: URL: https://github.com/apache/hadoop/pull/3047 This commit fixes the issue [here](https://issues.apache.org/jira/browse/MAPREDUCE-7346). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 601557) Remaining Estimate: 0h Time Spent: 10m > [Gridmix] A potential divide by zero in AvgRecordFactory > -------------------------------------------------------- > > Key: MAPREDUCE-7346 > URL: https://issues.apache.org/jira/browse/MAPREDUCE-7346 > Project: Hadoop Map/Reduce > Issue Type: Bug > Components: contrib/gridmix > Reporter: Yiyuan GUO > Priority: Major > Labels: gridmix, security > Time Spent: 10m > Remaining Estimate: 0h > > In the file _gridmix/AvgRecordFactory.java,_ one of the class's constructor > has the following > [code|https://github.com/apache/hadoop/blob/trunk/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/AvgRecordFactory.java#L63-#L68]: > {code:java} > 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; > ... > } > {code} > 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._ > -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: mapreduce-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: mapreduce-issues-h...@hadoop.apache.org