[ 
https://issues.apache.org/jira/browse/CASSANDRA-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Dusbabek updated CASSANDRA-1910:
-------------------------------------

    Attachment: v1-0001-examine-the-right-nibble-when-validating-TimeUUIDs.txt

> validation of time uuid is incorrect
> ------------------------------------
>
>                 Key: CASSANDRA-1910
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-1910
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Dave
>            Assignee: Gary Dusbabek
>            Priority: Minor
>             Fix For: 0.6.9, 0.7.1
>
>         Attachments: 
> v1-0001-examine-the-right-nibble-when-validating-TimeUUIDs.txt
>
>
> It appears _TimeUUIDType_ (as of 12/9) is checking the wrong bits when 
> validating a time UUID as version 1.
> Per the comment and rfc4122, "_version is bits 4-7 of byte 6_", however 
> validate() is actually checking the least significant bits:
> > _if ((slice.get() & 0x0f) != 1)_
> Sample java/hector code:
> {code}
> // displays "version 1" but validation fails
> java.util.UUID uuid1 = 
> java.util.UUID.fromString("00000000-0000-1000-0000-000000000000");
> System.out.println(uuid1 + " " + uuid1.version());
> TimeUUIDType.instance.validate(UUIDSerializer.get().toByteBuffer(uuid1));
> // displays "version 2" but validation succeeds
> java.util.UUID uuid2 = 
> java.util.UUID.fromString("00000000-0000-2100-0000-000000000000");
> System.out.println(uuid2 + " " + uuid2.version());
> TimeUUIDType.instance.validate(UUIDSerializer.get().toByteBuffer(uuid2));
> {code}
> The issue can be seen with any UUID where the timestamp doesn't start with 1:
> b54adc00-67f9-10d9-9669-0800200c9a66, (timestamp year 1776) version 1 fails
> b54adc00-67f9-12d9-9669-0800200c9a66, (timestamp year 2233) version 1 fails

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to