UUID version not correctly validated

Description

Using a UUID constraint which specifies a specific version to match, the version is actually ignored and all uuid versions can pass the constraint. An example would be this constraint:

which should only allow UUID version 4, however the following UUID (v5) passes the constraint as well:


This constraint & input combination results in the following state in UUIDValidator:

which correctly identified the versions from the constraint (4) and the version of the input uuid (5). However, the following binary search if the allowed versions array contains the uuid version checks for a return value of -1, which is incorrect as the method returns the possible insertion point which, in this case, can only be -2 or lower (for elements that are not yet in the array) as the array already contains one element (the insertion point is based on the order of the array, so 5 returns -2 because it would be after 4 in the array, but e.g. 3 would return -1 as it would be in front of 4):

Environment

Validator 8.0.1.Final, Java23.28+85-CA (Zulu)

Attachments

2

Activity

Show:

Marko Bekhta December 9, 2024 at 8:43 AM

Hey, thanks for bringing this up!

Fixed

Details

Assignee

Reporter

Bug Testcase Reminder (view)

Bug reports should generally be accompanied by a test case!

Bug Testcase Reminder (edit)

Bug reports should generally be accompanied by a test case!

Participants

Marko Bekhta
Pasqual Koschmieder

Components

Affects versions

Priority

Created December 8, 2024 at 12:02 AM
Updated December 13, 2024 at 5:40 PM
Resolved December 12, 2024 at 11:00 AM