On Thu Sep 14 16:12:06 2023 +0000, Dmitry Timoshkov wrote:
That's a lot of similar checks. Maybe estimate minimal size first and then check once? Also, ntdll function is not tested by itself, and its prototype was not validated as far as I can tell, so it's not possible to tell now where checks should be placed. Maybe having them only in kernelbase function is enough.
The checks are performed in a simiar way in other places. If you have a better idea how to do the size checks please share it. In any case CreateActCtxA() would have to perform the size check when converting the structure from A to W, and RtlCreateActivationContext() still needs to perform the check before accessing fields of the structure, so it seems unavoidable to have the checks in both places. There's no a single test in dlls/ntdll/tests for RtlCreateActivationContext(), so I'd guess that it's assumed that its functionality is covered by CreateActCtxW(), otherwise it's necessary to port all the exicting CreateActCtxW() tests for RtlCreateActivationContext(), do you really insist on it?
I don't insist on anything, but only pointing at potential improvements.