Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null Reference Exception in SarifLogger when Extensions are specified. #2808

Open
derigel23 opened this issue Apr 26, 2024 · 1 comment
Open

Comments

@derigel23
Copy link

derigel23 commented Apr 26, 2024

Here is an extract from the code:

            // Map existing Rules to ensure duplicates aren't created
            if (_run.Tool.Extensions != null)
            {
                RecordRules(extensionIndex: null, _run.Tool.Driver);

                for (int extensionIndex = 0; extensionIndex < _run.Tool.Extensions.Count; ++extensionIndex)
                {
                    ToolComponent extension = _run.Tool.Extensions[extensionIndex];
                    ExtensionGuidToIndexMap[extension.Guid.Value] = extensionIndex;
                    RecordRules(extensionIndex, extension);
                }

            }

extension.Guid is an optional value, but here we have access to its Value without any checking and get NRE.

@derigel23
Copy link
Author

3.19.6 guid property
A toolComponent object MAY contain a property named guid whose value is a GUID-valued string (§3.5.3) that provides a unique, stable identifier for the component. guid SHALL NOT vary between versions of a given component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant