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

* [metadata] Create strongly typed versions of mono_assembly_request_prepare

Addresses the family of issues similar to Coverity mono/mono#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.

Commit migrated from https://github.com/mono/mono/commit/ce92c4376f31e9caf964938a3899d179bdc97e51
12 files changed:
src/mono/mono/dis/main.c
src/mono/mono/metadata/appdomain.c
src/mono/mono/metadata/assembly-internals.h
src/mono/mono/metadata/assembly.c
src/mono/mono/metadata/attach.c
src/mono/mono/metadata/coree.c
src/mono/mono/metadata/domain.c
src/mono/mono/metadata/mono-security.c
src/mono/mono/metadata/w32socket.c
src/mono/mono/mini/aot-runtime.c
src/mono/mono/mini/driver.c
src/mono/mono/mini/main-core.c