Donal Evans created GEODE-9429: ---------------------------------- Summary: 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
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)