[0.4.9][NTGDI] Fix potential BSOD 0x1E CORE-17626
authorJoachim Henze <Joachim.Henze@reactos.org>
Mon, 15 Nov 2021 11:08:14 +0000 (12:08 +0100)
committerJoachim Henze <Joachim.Henze@reactos.org>
Mon, 15 Nov 2021 11:08:14 +0000 (12:08 +0100)
commit33ebdeff91b7ad709aae27ca858f6afd9c621f87
treeeb820e91869a201ab929b811d8d88bb534d21afd
parent4e0a41bcb8a36159b386d733fb63645192a1b5e0
[0.4.9][NTGDI] Fix potential BSOD 0x1E CORE-17626

in CreateDIBPalette() when passing invalid arguments to CreateDIBSection.
This could be triggered by using the broken test-application "GDIProg".

After this patch not only the BSOD is fixed but also the app does
properly start up, like it is the case on 2k3sp2.

The problem was unhidden by the innocent and unrelated 0.4.12-dev-266-g 8ab3652c0112d152ba87ea10db15a6837dc89e94
I was not able to trigger the bug in releases older than 0.4.12,
but it is rather obvious that the mentioned revision is not really 'guilty', which
is why I will port the fix back further into releases even older than 0.4.12 as well.

Thanks to the patches author Doug Lyons.

a squashed port of:
0.4.15-dev-2734-g 514147776a7e70636911033ab6c89779b2c8ee1e (fixes the BSOD)
0.4.15-dev-2775-g c596fd3ef6933c9eec95a47c807d01d3776bbcc0 (improvement #3758)
0.4.15-dev-2776-g 4130f0b1c5f869614c71818bb7c30447d894afc8 (compilation fix)
and some white-space tweaking that was committed after those.
win32ss/gdi/ntgdi/dibobj.c