dotnet/runtime

Сhecking for NULL

Open

#92.566 aperta il 24 set 2023

Vedi su GitHub
 (2 commenti) (1 reazione) (0 assegnatari)C# (5445 fork)batch import
area-TypeSystem-coreclrhelp wanted

Metriche repository

Star
 (17.886 star)
Metriche merge PR
 (Merge medio 12g 11h) (661 PR mergiate in 30 g)

Descrizione

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.

Guida contributor