Skip to content

One NPE in RouterChain.java #1048

@containerAnalyzer

Description

@containerAnalyzer

Hello,

Our static analyzer found a following potential NPE. We have checked the feasibility of this execution trace. It is necessary to defend this vulnerability to improve the code quality.

Here is the bug trace.

  1. Return null to caller

    return all == null ? null : all.get(alias);

  2. Function getExtensionClass executes and stores the return value to the parameter of add, which can be null

    extensionRouters.add(EXTENSION_LOADER.getExtensionClass(routerAlias));

  3. Function add executes and returns. One of the elements in extensionRouters can be null.

    extensionRouters.add(EXTENSION_LOADER.getExtensionClass(routerAlias));

  4. Function next executes and stores the return value to extensionRouter (extensionRouter can be null)

    for (ExtensionClass<Router> extensionRouter : extensionRouters) {

  5. extensionRouter is passed as this pointer to function getExtInstance (extensionRouter can be null), which will lead to null pointer dereference

    Router actualRoute = extensionRouter.getExtInstance();

Commit: 4f824e2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions