Windows: Harden QRawFont loading of fonts


When loading a font through QRawFont, we would directly dereference
the offset we get from the table directory for the OS/2 table.

It was not possible to make the application crash, since both
DirectWrite and GDI already protect against poison data in the
table directory, but for extra robustness, we should also check
against this in Qt. This also adds a test to verify that broken
OS/2 table cannot make the application crash. Note that this test
also passed before the fix, as the system would refuse to load the
font to begin with.

Pick-to: 6.12
Task-number: QTBUG-151514
Change-Id: I817364630234ff80d1ec78e0b1e12063c691d6a8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
commit903313b92e52231650bc6132233fcc3178473c2f
parentafeb181a7ac121a60fea10dc06a4da8d6fc42d4e
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
commit timeTue, 20 Oct 2026 09:59:25 +0000