buildingSMART Forums

Fatal error - IfcGuid is not a 128-bit number

The documentation says:
“An IfcGloballyUniqueId is a Globally Unique Identifier (GUID) which is an auto-generated 128-bit number.”

However:

0123456789012345678901234567890123456789012345678901234567890123
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$
=>
64 values * 22char = 6bit * 22char = 132bit So there are 4extra bits and only 2 bits in first character are meningful.
In other words the first character in IFCGUID can only be ‘0’-‘3’.

E.g.
2sif80O2kC83_GLKmIlyJ$ => b2ffcafc-a5db-4d28-b01a-1b72abeed016
Asif80O2kC83_GLKmIlyJ$ => b2ffcafc-a5db-4d28-b01a-1b72abeed016

In this case A(001010) -> 2 (000010)

And this is why its pretty bad bug because converting back to 128 does not work.

So what this means:
This brings an increased risk of malfunction if a software imports ifc and the native data model of the software uses UUID converted from IfcGUID.
E.g. An ifcfile contains two instances of IfcBuilding (A & B). The Building A has a guid(2sif80O2kC83_GLKmIlyJ$) and the Building B has a guid (Asif80O2kC83_GLKmIlyJ).
When the ifcfile converted to the native data model, both of the buildings have the same UUID(b2ffcafc-a5db-4d28-b01a-1b72abeed016)!!
Then it’s up to the software what will happen next. If user didn’t get any fatal error messages what, would happen when the user let’s say creates a bill of quantities of building(b2ffcafc-a5db-4d28-b01a-1b72abeed016) ?

-Sami Lyden & Hannu Lahtela-

1 Like

You are absolutely right, not every random combination of characters from the character set can be produced from the encoding. Thus, Asif80O2kC83_GLKmIlyJ$ is not a valid value for the IfcGloballyUniqueId. No software should produce such a GUID, same as it should not produce GUIDs with less than or more than 22 characters. Encoding of 0xB2FFCAFCA5DB4D28B01A1B72ABEED016 should always result in 2sif80O2kC83_GLKmIlyJ$.

This is not an unusual issue. For example, there are some byte sequences that will never appear in UTF-8 encodings. Hence, a random byte sequence may be invalid UTF-8, impossible to decode.

1 Like