mirror of https://github.com/apache/cassandra
Validate SliceRange start and finish lengths
patch by Ben Bromhead; reviewed by Aleksey Yeschenko for CASSANDRA-6521
This commit is contained in:
parent
9244923451
commit
a58a95ddbb
|
|
@ -4,6 +4,7 @@
|
|||
* Don't resubmit counter mutation runnables internally (CASSANDRA-6427)
|
||||
* Don't drop local mutations without a trace (CASSANDRA-6510)
|
||||
* Don't allow null max_hint_window_in_ms (CASSANDRA-6419)
|
||||
* Validate SliceRange start and finish lengths (CASSANDRA-6521)
|
||||
|
||||
|
||||
1.2.13
|
||||
|
|
|
|||
|
|
@ -228,6 +228,15 @@ public class ThriftValidation
|
|||
|
||||
public static void validateRange(CFMetaData metadata, ColumnParent column_parent, SliceRange range) throws org.apache.cassandra.exceptions.InvalidRequestException
|
||||
{
|
||||
if (range.count < 0)
|
||||
throw new org.apache.cassandra.exceptions.InvalidRequestException("get_slice requires non-negative count");
|
||||
|
||||
if (range.start.remaining() > IColumn.MAX_NAME_LENGTH)
|
||||
throw new org.apache.cassandra.exceptions.InvalidRequestException("range start length cannot be larger than " + IColumn.MAX_NAME_LENGTH);
|
||||
|
||||
if (range.finish.remaining() > IColumn.MAX_NAME_LENGTH)
|
||||
throw new org.apache.cassandra.exceptions.InvalidRequestException("range finish length cannot be larger than " + IColumn.MAX_NAME_LENGTH);
|
||||
|
||||
AbstractType<?> comparator = metadata.getComparatorFor(column_parent.super_column);
|
||||
try
|
||||
{
|
||||
|
|
@ -239,9 +248,6 @@ public class ThriftValidation
|
|||
throw new org.apache.cassandra.exceptions.InvalidRequestException(e.getMessage());
|
||||
}
|
||||
|
||||
if (range.count < 0)
|
||||
throw new org.apache.cassandra.exceptions.InvalidRequestException("get_slice requires non-negative count");
|
||||
|
||||
Comparator<ByteBuffer> orderedComparator = range.isReversed() ? comparator.reverseComparator : comparator;
|
||||
if (range.start.remaining() > 0
|
||||
&& range.finish.remaining() > 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue