[
https://issues.apache.org/jira/browse/GEODE-9429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17381515#comment-17381515
]
ASF subversion and git services commented on GEODE-9429:
--------------------------------------------------------
Commit 970497912dec5af43605842195bc8a7dd1479851 in geode's branch
refs/heads/develop from Donal Evans
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=9704979 ]
GEODE-9424: Accept Long arguments for Redis commands (#6698)
- Do not return errors when arguments are specified that are less than
Integer.MIN_VALUE or less than Integer.MAX_VALE
- Convert long arguments outside the above range to Integer.MIN_VALUE
or Integer.MAX_VALUE to be used internally
- Add tests for new Coder method and coverage for existing supported
commands that take integer arguments, except HSCAN which will require
GEODE-9429 to be fixed first
Authored-by: Donal Evans <[email protected]>
> Radish HSCAN implementation cannot handle values for COUNT greater than
> Integer.MAX_VALUE / 2
> ---------------------------------------------------------------------------------------------
>
> Key: GEODE-9429
> URL: https://issues.apache.org/jira/browse/GEODE-9429
> Project: Geode
> Issue Type: Bug
> Components: redis
> Affects Versions: 1.15.0
> Reporter: Donal Evans
> Priority: Major
>
> The below code is the current implementation of HSCAN in {{RedisHash}}. When
> the value of {{count}} passed to this method is greater than
> {{Integer.MAX_VALUE / 2}} the condition of the while loop suffers from
> integer overflow and the loop does not execute correctly.
> {code:java}
> public ImmutablePair<Integer, List<byte[]>> hscan(Pattern matchPattern, int
> count, int cursor) {
> ArrayList<byte[]> resultList = new ArrayList<>(count + 2);
> do {
> cursor = hash.scan(cursor, 1,
> (list, key, value) -> addIfMatching(matchPattern, list, key,
> value), resultList);
> } while (cursor != 0 && resultList.size() < (count * 2));
> return new ImmutablePair<>(cursor, resultList);
> {code}
> This could be fixed by changing the type of {{resultList}} to
> {{List<ImmutablePair<byte[] byte[]>>}} and modifying the {{addIfMatching()}}
> method to populate the list with {{ImmutablePair}}s of keys and values rather
> than a single continuous list of interleaved keys and values.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)