[metadata] Create strongly typed versions of mono_assembly_request_prepare (#16094)
commitce92c4376f31e9caf964938a3899d179bdc97e51
authorAleksey Kliger (λgeek) <alklig@microsoft.com>
Wed, 14 Aug 2019 19:07:26 +0000 (14 15:07 -0400)
committerGitHub <noreply@github.com>
Wed, 14 Aug 2019 19:07:26 +0000 (14 15:07 -0400)
tree402f14d995c9c6d31bcbce81a951aaf9bbb3b538
parenta6b8494f0a9a28eccd15b20d0973270441d05ccc
[metadata] Create strongly typed versions of mono_assembly_request_prepare (#16094)

* [metadata] Create strongly typed versions of mono_assembly_request_prepare

Addresses the family of issues similar to Coverity #1443346.

This came up as part of the Coverity review, and Coverity notices that this is
writting beyond the end of the structure.  While this is correct, this requires
that the idiom be properly followed - that is, that the structure being passed
is of the given size.

Replaced instead with a method that eliminates the room for error with methods
that will initialize the whole structure, and the actual size computation is
done inside the method with the proper type sizes.

While I used methods, I feel that this should use macros.
13 files changed:
mono/dis/main.c
mono/metadata/appdomain.c
mono/metadata/assembly-internals.h
mono/metadata/assembly.c
mono/metadata/attach.c
mono/metadata/coree.c
mono/metadata/domain.c
mono/metadata/mono-security.c
mono/metadata/w32socket.c
mono/mini/aot-runtime.c
mono/mini/driver.c
mono/mini/main-core.c
tools/pedump/pedump.c