You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-issues@hadoop.apache.org by "Yiyuan GUO (Jira)" <ji...@apache.org> on 2021/05/20 02:40:00 UTC
[jira] [Created] (MAPREDUCE-7346) [Gridmix] A potential divide by
zero in AvgRecordFactory
Yiyuan GUO created MAPREDUCE-7346:
-------------------------------------
Summary: [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
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-unsubscribe@hadoop.apache.org
For additional commands, e-mail: mapreduce-issues-help@hadoop.apache.org