[
https://issues.apache.org/jira/browse/MAPREDUCE-7346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18041581#comment-18041581
]
ASF GitHub Bot commented on MAPREDUCE-7346:
-------------------------------------------
github-actions[bot] closed pull request #3047: MAPREDUCE-7346. Fix divide by
zero in AvgRecordFactory
URL: https://github.com/apache/hadoop/pull/3047
> [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, pull-request-available, security
> Time Spent: 0.5h
> 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.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]