Nullable GIF input causes NullPointerException in GifStreamObject.load
Maintainers usually reply within 3 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 62/100
Research direction
Start in encoder/src/main/java/com/pedro/encoder/input/gl/render/filters/object/GifFilterRender.kt around setGif, then GifStreamObject.java where load calls inputStreamGif.available() without a null check. Reproduce with the single-line test from the issue in the encoder module's local unit tests. Done when a null stream is rejected with IOException, as the issue suggests, and the regression test passes. The API choice between IOException and a non-null signature may need a maintainer decision.
Written by the indexing model from the issue text.
Description
Describe the bug
GifFilterRender.setGif(inputStream: InputStream?) accepts a nullable stream, but forwards it to GifStreamObject.load, which calls inputStreamGif.available() without checking for null. Consequently, setGif(null) throws NullPointerException.
This is an inconsistency between the public Kotlin parameter type and the Java loading implementation. The reproducer intentionally supplies null; it does not demonstrate a failure when loading a valid GIF.
To reproduce
Run this local unit test in the encoder module against commit 82a9cb4ee4babdc792d2ccee8b893f2b36207d40:
import com.pedro.encoder.input.gl.render.filters.`object`.GifFilterRender
import org.junit.Test
class GifNullInputTest {
@Test
fun reproduce() {
GifFilterRender().setGif(null)
}
}
The call fails with NullPointerException inside GifStreamObject.load at inputStreamGif.available().
Expected behavior
Handle null consistently with the public API contract. One option is to reject null with IOException, which is already used for GIF loading failures, while preserving the nullable Kotlin signature. Alternatively, the API could explicitly require a non-null stream.
Environment
- Source version:
2.8.1, commit82a9cb4ee4babdc792d2ccee8b893f2b36207d40. - Class:
GifFilterRender/GifStreamObject, moduleencoder. - Reproduced in the project's Android local unit test task using JDK 17, Gradle 9.7.1 and compile SDK 35.
- Device / Android OS / media server: not involved in this local unit test reproduction.
Additional context
Relevant source: nullable Kotlin entry point, Java dereference.
I have a small fix and a regression test ready. The test expects IOException: it fails with NPE before the fix and passes after it. With only this fix and its test applied, all 26 encoder and 98 common local unit tests pass.
- Dominant language
- Kotlin
- Stars
- 3k
- Forks
- 946
- Avg merge
- 5d 1h
- Merged PRs (30d)
- 6
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pedroSG94/RootEncoder
-
Scheme-less stream URLs throw NullPointerException instead of URISyntaxExceptionPossibly taken @blihio claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
pedroSG94/RootEncoder#2218 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
pedroSG94/RootEncoder#2213 ·
Maintainers usually reply within 3 days
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
pedroSG94/RootEncoder#2207 · 1 reaction ·
Maintainers usually reply within 3 days
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
pedroSG94/RootEncoder#2203 ·
Maintainers usually reply within 3 days
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
pedroSG94/RootEncoder#2192 · 2 comments ·
Maintainers usually reply within 3 days
All issues in pedroSG94/RootEncoder
Similar issues
-
bug follow-up
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
binding:web core docs p3
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
RunanywhereAI/runanywhere-sdks#1123 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
openai/openai-java#1202 ·
Maintainers usually reply within 1 day
-
StepExamBenchmarkTest runs a loop and prints a timing but asserts nothingPossibly taken A pull request linked to this issue is open or already merged. Openjules
Difficulty 1/5 Under an hour Newbie friendliness 82/100
open-learning-exchange/myplanet#18199 · 1 comment ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
auth0/Auth0.Android#1095 · 1 comment ·
Maintainers usually reply within 1 day