equinor / equinor/resdata

Unchecked input in rd_string_name()

Open Beginner friendly
#1,228 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
127
Forks
103
Avg merge
2d 5h
Merged PRs (30d)
18

Description

is_rd_string_name() reads type_name[1..3] unconditionally, so calling it with a short string (e.g. "C" or "") is undefined behavior (out-of-bounds read). Since this code path is now expected to throw on invalid inputs (for fuzzing/error handling), add a length guard before calling is_rd_string_name() in rd_type_create_from_name().

Contributor guide

Open the contributing guide

Research direction

Start at rd_type_create_from_name() and inspect its call to is_rd_string_name(), focusing on how short names such as "C" and "" are handled. Done means invalid short inputs no longer cause an out-of-bounds read and instead follow the expected error-throwing path.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.