crossoverJie / crossoverJie/JCSprout

A potential NPE bug

Open
#195 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
26.8k
Forks
7k
PR merge metrics
No merged PRs in 30d

Description

Hi all, our bug scanner has reported a NPE bug.

A possible call chain may be [getNode()](https://github.com/crossoverJie/JCSprout/tree/master/src/main/java/com/crossoverjie/actual/LRUMap.java#L107) => [LRUMap.java#L65](https://github.com/crossoverJie/JCSprout/tree/master/src/main/java/com/crossoverjie/actual/LRUMap.java#L65) => [LRUMap.java#L68](https://github.com/crossoverJie/JCSprout/tree/master/src/main/java/com/crossoverjie/actual/LRUMap.java#L68). Since the method `getNode()` may return `null` at [LRUMap.java#L118](https://github.com/crossoverJie/JCSprout/tree/master/src/main/java/com/crossoverjie/actual/LRUMap.java#L118), a NPE bug may take place at [LRUMap.java#L76](https://github.com/crossoverJie/JCSprout/tree/master/src/main/java/com/crossoverjie/actual/LRUMap.java#L76) when the variable `node` is `null`.

Thanks.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading src/main/java/com/crossoverjie/actual/LRUMap.java around lines 65-76 and 107-118, following the reported getNode() call chain. Determine whether a null node can reach line 76, then add coverage for that path and verify the issue no longer produces an NPE.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.