The OSLIB factory needed two safety fixes.
First, chFactoryDuplicateReference() was incrementing object reference
counters without using the factory lock, while create/find/release paths were
serialized. This created a race against final release and object reclamation.
Second, the heap-backed factory creators (Buffer, Mailbox, ObjectsFIFO, Pipe)
were performing unchecked add/multiply/alignment arithmetic when computing
allocation sizes. Extreme input values could overflow those calculations
before allocation, leading to undersized objects and out-of-bounds
initialization.
The fix: