You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2026/04/11 15:22:00 UTC
[jira] [Updated] (HDFS-16029) Divide by zero bug in InstrumentationService.java
[ https://issues.apache.org/jira/browse/HDFS-16029?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated HDFS-16029:
----------------------------------
Labels: easy-fix pull-request-available security (was: easy-fix security)
> Divide by zero bug in InstrumentationService.java
> -------------------------------------------------
>
> Key: HDFS-16029
> URL: https://issues.apache.org/jira/browse/HDFS-16029
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: libhdfs
> Reporter: Yiyuan GUO
> Priority: Major
> Labels: easy-fix, pull-request-available, security
>
> In the file _lib/service/instrumentation/InstrumentationService.java,_ the method
> _Timer.getValues_ has the following [code|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/service/instrumentation/InstrumentationService.java#L236]:
> {code:java}
> long[] getValues() {
> ......
> int limit = (full) ? size : (last + 1);
> ......
> values[AVG_TOTAL] = values[AVG_TOTAL] / limit;
> }
> {code}
> The variable _limit_ is used as a divisor. However, its value may be equal to _last + 1,_ which can be zero since _last_ is initialized to -1 in the [constructor|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/service/instrumentation/InstrumentationService.java#L222]:
> {code:java}
> public Timer(int size) {
> ...
> last = -1;
> }
> {code}
> Thus, a divide by zero problem can happen.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org