newPool() allocates memory without checking for NULL
- Dominant language
- Java
- Stars
- 253
- Forks
- 178
- PR merge metrics
- No merged PRs in 30d
Description
In [antlr3collections.c](https://github.com/antlr/antlr3/blob/master/runtime/C/src/antlr3collections.c), the function `newPool()` is calling both `realloc` and `malloc` without properly handling the out of memory (NULL return) case.
This ultimately leads to my application crashing in [antlr3commontoken.c](https://github.com/antlr/antlr3/blob/master/runtime/C/src/antlr3commontoken.c), in `newPoolToken()` with an access violation caused by a NULL pointer dereference.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in runtime/C/src/antlr3collections.c at newPool(), then inspect runtime/C/src/antlr3commontoken.c at newPoolToken() to understand the reported NULL dereference. Trace both realloc and malloc results and verify that out-of-memory returns are handled without the application crashing through a NULL pointer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100