Control: tags -1 + fixed-upstream

(I'm the new upstream for all OSSP software, bisect says fixed in
 
<https://git.sr.ht/~nabijaczleweli/ossp-uuid/commit/0f6fe0347dcae80616d46bd85bf32acecca1c4f0>.)

On Thu, Jul 20, 2023 at 03:15:11PM +0000, Tim Duesterhus wrote:
> I ran `uuid -d 00000000-0000-1100-a000-000000000000` and noticed that the time
> content was strangely formatted with a dot where a digit should be:
An astute reader may note that this is actually UUID time 100000000000000,
which is 1811-02-16. So yeah, definitely uninitialised value,
which it appears I've fixed by accident while replacing
ossp-str and/or ossp-ui64 with stdio and uint64_t, respectively.

The buffer for the time string is only good until 9999-12-31
(and strftime()d, so no chance of corruption, just truncation as you saw),
but the largest UUID time is 0x0FFFFFFFFFFFFFFF (60 bits),
so 115292150460 seconds since UUID epoch,
so 103072857660 seconds since UNIX epoch,
so year 5236, and indeed:
  $ ./uuid -d FFFFFFFF-FFFF-1FFF-bfc1-efc8990bbfa4
  t=0fffffffffffffff
  encode: STR:     ffffffff-ffff-1fff-bfc1-efc8990bbfa4
          SIV:     340282366920937405648653289334120365988
  decode: variant: DCE 1.1, ISO/IEC 11578:1996
          version: 1 (time and node based)
          content: time:  5236-03-31 21:21:00.684697.5 UTC
                   clock: 16321 (usually random)
  node:  ef:c8:99:0b:bf:a4 (local multicast)
and this fits within the buffer.

I've kept these as test cases
(https://git.sr.ht/~nabijaczleweli/ossp-uuid/commit/f6c3b1478a12b8ce918faea6e4f60df5f005014e).

Thanks for the report,
наб

Attachment: signature.asc
Description: PGP signature

Reply via email to