dotnet/runtime

Сhecking for NULL

Open

#92,566 opened on Sep 24, 2023

View on GitHub
 (2 comments) (1 reaction) (0 assignees)C# (5,445 forks)batch import
area-TypeSystem-coreclrhelp wanted

Repository metrics

Stars
 (17,886 stars)
PR merge metrics
 (Avg merge 12d 11h) (661 merged PRs in 30d)

Description

Description

We have two pointer pMT dereferences: https://github.com/dotnet/runtime/blob/cc2670b53ecc1576d3aa1a1011476c99372adfd7/src/coreclr/vm/typedesc.cpp#L888 https://github.com/dotnet/runtime/blob/cc2670b53ecc1576d3aa1a1011476c99372adfd7/src/coreclr/vm/typedesc.cpp#L909 And they are absolutely identical. But before the second dereference there is a check for NULL, before the first there is not. I assume two options. The first option is an unnecessary check. The second option is that the pointer at the first dereference can really be NULL. Between these two dereferences, the pointer pMT itself does not change. Only the following lines: https://github.com/dotnet/runtime/blob/cc2670b53ecc1576d3aa1a1011476c99372adfd7/src/coreclr/vm/typedesc.cpp#L890-L898 Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.

Author A. Voronin.

Contributor guide