[loader] Don't store through a null ptr (mono/mono#14110)
authorAleksey Kliger (λgeek) <akliger@gmail.com>
Fri, 19 Apr 2019 19:57:31 +0000 (15:57 -0400)
committerGitHub <noreply@github.com>
Fri, 19 Apr 2019 19:57:31 +0000 (15:57 -0400)
commit452181fe7420410a64b3e6e390caa5a9f96bcff4
treed43be4ab191f07cac969c26d6e9d84d0a9b6e489
parentaa97d6f4a7d7f5c2b471d5213bf73d000330152c
[loader] Don't store through a null ptr (mono/mono#14110)

* [loader] Dont't store through a null ptr

If 'status' is null, don't try to write to it.

Fixes https://github.com/mono/mono/issues/13941

* [metadata] Protect writes to MonoImageOpenStatus* in a few places.

When possible assert that `MonoImageOpenStatus *status` arguments to various
functions in the runtime aren't null.  There are a few places (MONO_API) where
it's possible that callers are passing null.  In that case, use a local
MonoImageOpenStatus, or check for null before doing assignments.

Commit migrated from https://github.com/mono/mono/commit/7ba1f77f6da6375bd941b6bac0bbab3bb30ddd6b
src/mono/mono/metadata/assembly.c
src/mono/mono/metadata/image.c