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/09/30 20:46:00 UTC

[jira] [Comment Edited] (HADOOP-18471) An unhandled ArrayIndexOutOfBoundsException in DefaultStringifier.storeArray() if provided with an empty input

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

FuzzingTeam edited comment on HADOOP-18471 at 9/30/22 8:45 PM:
---------------------------------------------------------------

The method storeArray uses the 1st element of the input array ({*}K{*}{*}[] items{*}) to get the class for the *stringifier* without checking for an empty array, and hence, causes the exception to be thrown.

 

*Code snippet of where the AIOBE throws:*
{code:java}
public static <K> void storeArray(Configuration conf, K[] items,
    String keyName) throws IOException {

  DefaultStringifier<K> stringifier = new DefaultStringifier<K>(conf, 
      GenericsUtil.getClass(items[0]));                                  // <---- thrown here
  ...
} {code}
 

*Solution:*

We propose adding null and empty checks for the input array.


was (Author: JIRAUSER296392):
The method storeArray uses the 1st element of the input array ({*}K{*}{*}[] items{*}) to get the class for the *stringifier* without checking for an empty array, and hence, causes the exception to be thrown.

 

*Code snippet of where the AIOBE throws:*
{code:java}
public static <K> void storeArray(Configuration conf, K[] items,
    String keyName) throws IOException {

  DefaultStringifier<K> stringifier = new DefaultStringifier<K>(conf, 
      GenericsUtil.getClass(items[0]));                                  // <---- thrown here
  ...
} {code}
 

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

*We propose adding null and empty checks for the input array.*

> An unhandled ArrayIndexOutOfBoundsException in DefaultStringifier.storeArray() if provided with an empty input
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-18471
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18471
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: common, io
>    Affects Versions: 3.3.4
>            Reporter: FuzzingTeam
>            Priority: Major
>
> The code throws an unhandled ArrayIndexOutOfBoundsException when method _storeArray_ of DefaultStringifier.java is called with an empty array as input.



--
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