Date: Thu, 3 Aug 2006 03:34:37 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/lib/libc/uuid uuid_compare.c Message-ID: <200608030334.k733Ybwd052986@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
delphij 2006-08-03 03:34:36 UTC
FreeBSD src repository
Modified files:
lib/libc/uuid uuid_compare.c
Log:
In DCE 1.1, the time_low value is defined as an unsigned 32-bit
integer. Presently, our implementation employs an approach that
converts the value to int64_t, then back to int, unfortunately,
this approach can be problematic when the the difference between
the two time_low is larger than 0x7fffffff, as the value is then
truncated to int.
To quote the test case from the original PR, the following is
true with the current implementation:
865e1a56-b9d9-11d9-ba27-0003476f2e88 < 062ac45c-b9d9-11d9-ba27-0003476f2e88
However, according to the DCE specification, the expected result
should be:
865e1a56-b9d9-11d9-ba27-0003476f2e88 > 062ac45c-b9d9-11d9-ba27-0003476f2e88
This commit adds a new intermediate variable which uses int64_t
to store the result of subtraction between the two time_low values,
which would not introduce different semantic of the MSB found in
time_low value.
PR: 83107
Submitted by: Steve Sears <sjs at acm dot org>
MFC After: 1 month
Revision Changes Path
1.5 +15 -5 src/lib/libc/uuid/uuid_compare.c
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608030334.k733Ybwd052986>
