You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "FuzzingTeam (Jira)" <ji...@apache.org> on 2022/10/22 10:59:00 UTC

[jira] [Comment Edited] (HADOOP-18505) ArrayIndexOutOfBoundsException in TestCoderBase.java

    [ https://issues.apache.org/jira/browse/HADOOP-18505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17622606#comment-17622606 ] 

FuzzingTeam edited comment on HADOOP-18505 at 10/22/22 10:58 AM:
-----------------------------------------------------------------

*Code snippet of where* {*}ArrayIndexOutOfBoundsException occurs{*}{*}:{*}
{code:java}
int idx = 0;

for (int i = 0; i < erasedDataIndexes.length; i++) {
  toEraseChunks[idx ++] = dataChunks[erasedDataIndexes[i]];
  dataChunks[erasedDataIndexes[i]] = null;
}

for (int i = 0; i < erasedParityIndexes.length; i++) {
  toEraseChunks[idx ++] = parityChunks[erasedParityIndexes[i]];
  parityChunks[erasedParityIndexes[i]] = null;
}{code}
 

*Solution:-*

We propose to add a check to prevent the java.lang.ArrayIndexOutOfBoundsException.

We also propose fixing the exception type from IllegalArgumentException to HadoopIllegalArgumentException in _DecodingState_ class as done in several places around that code.


was (Author: JIRAUSER296392):
*Code snippet of where* {*}ArrayIndexOutOfBoundsException occurs{*}{*}:{*}
{code:java}
int idx = 0;

for (int i = 0; i < erasedDataIndexes.length; i++) {
  toEraseChunks[idx ++] = dataChunks[erasedDataIndexes[i]];
  dataChunks[erasedDataIndexes[i]] = null;
}

for (int i = 0; i < erasedParityIndexes.length; i++) {
  toEraseChunks[idx ++] = parityChunks[erasedParityIndexes[i]];
  parityChunks[erasedParityIndexes[i]] = null;
}{code}
 

{*}Solution:-{*}{*}{*}

We propose to add a check to prevent the java.lang.ArrayIndexOutOfBoundsException.

We also propose fixing the exception type from IllegalArgumentException to HadoopIllegalArgumentException in _DecodingState_ class as done in several places around that code.

> ArrayIndexOutOfBoundsException in TestCoderBase.java
> ----------------------------------------------------
>
>                 Key: HADOOP-18505
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18505
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 3.3.4
>            Reporter: FuzzingTeam
>            Priority: Major
>              Labels: pull-request-available
>
> The code throws an unhandled ArrayIndexOutOfBoundsException in the method _backupAndEraseChunks_ of _TestCoderBase_ class when it tries to access the out of bound indexes in _dataChunks_ and _parityChunks_ array.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org